Forum Discussion
Working with iframe (Web Object)
I have a Web Object with javascript content that opens another module from Workday.
So basically this happens:
- I have a storyline module with a Web Object that open an Html/Jscript landing page
- When I user clicks on a button in that web object it opens another workday module in a new page ("_blank").
I tried using "_self" but I get an error because workday can't open another module inside the current Web Object iFrame. Also tried "_Parent" and "_Top" but for some reason in this case Workday opens the same module (the initial one) and not the one that it should redirect to.
So is there a way to close the current window and open a new window? Or open the new module at the parent level of the iFrame?
- SamHillSuper Hero
Hi RonLinder-4c1a3 in the HTML page you have in the WebObject for navigation, just add this function to the <head> of the HTML page and wrap it in <script></script> tags:
function goToProject(newLocation) { window.parent.location.href = newLocation; }
You can then call this function and just pass the URL, from a button, or link. Here are some examples:
// from a link <a> <a href="javascript:void(0);" onclick="goToProject('https://abc.com/widgets101/introduction/story.html');">Introduction</a> // from a button <button> <button onclick="goToProject('https://abc.com/widgets101/introduction/story.html');">Introduction</button>
- RonLinder-4c1a3Community Member
This did not work but I managed to use a diffrent approach which worked. Thanks.
- SamHillSuper Hero
Maybe I'd misunderstood the problem, as the solution I posted worked just fine for me. What did you go with in the end, as it might help others looking for a similar solution RonLinder-4c1a3