Forum Discussion

RonLinder-4c1a3's avatar
RonLinder-4c1a3
Community Member
2 months ago

Working with iframe (Web Object)

I have a Web Object with javascript content that opens another module from Workday.

So basically this happens:

  1. I have a storyline module with a Web Object that open an Html/Jscript landing page
  2. 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?

  • After numerous trial/error I realized there is no way of closing the current window. The only way is to open the content at the same level as the initial one but you still end up having the parent window open (since that main window is opened by workday itself).

     

    So in summary when someone opens a module in Workday this happens:

    Workday page opens --> user clicks to open module --> new pop-up opens with module --> user clicks inside the storyline module to navigate to new module --> new module opens in that same pop-up but also opens a new Workday page relating to that new module.

    So it works but you'll get a bunch of Workday tabs for each module clicked since you can't close them.

  • 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-4c1a3's avatar
      RonLinder-4c1a3
      Community Member

      After numerous trial/error I realized there is no way of closing the current window. The only way is to open the content at the same level as the initial one but you still end up having the parent window open (since that main window is opened by workday itself).

       

      So in summary when someone opens a module in Workday this happens:

      Workday page opens --> user clicks to open module --> new pop-up opens with module --> user clicks inside the storyline module to navigate to new module --> new module opens in that same pop-up but also opens a new Workday page relating to that new module.

      So it works but you'll get a bunch of Workday tabs for each module clicked since you can't close them.

  • This did not work but I managed to use a diffrent approach which worked. Thanks.

    • SamHill's avatar
      SamHill
      Super 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