How do I load url on iframe?

0 favourites
  • 10 posts
  • hi in my app i have two layouts,

    in the first layout i have differents butons, if i click on buton one it load the layout 2 where the iframe is placed.

    i did this but nothing is working, when user click on buton 1, the global number var is set to 1.

    if compared values URL_VAR1=1 iframe set url to "" and then go to layout 2

    in the layout 2, compare value if URL_VAR1=1, iframe load URL_VAR1.

    but its not working i want the iframe to load differents urls per butons ( one url per buton in layout 1)

    i get a loop with this error:

    Access Denied

    You don't have permission to access "" on this server.

    Reference #18.25535d68.1512479426.a11065c

    and the Reference #18.25535d68.1512479426.a11065c is changing in loop and i cant access the url

    this is my menu butons at he moment i only use buton 1 (top)

    can someone help?

  • Note that some sites won't open in iFrames. Others will detect the iFrame and refresh out of it. So. I'd suggest you check the sites you want to open in the iframe outside of your construct app, before trying to solve the problem on construct. A simples way to do that is by accesing the iframe TryIt! tool at w3schools ( ... tml_iframe), changing the url there and hitting "Run". If it doesn't open there, it wo'nt open on your construct app. For instance, I just checked "" and it doesn't open in iframes...

    Hope this helps. Cheers!

  • well this is what i have at the moment

    if i add the url in the left settings of the iframe websites are loaded

    if i leave the iframe settings without a default url

    and try to load urls from the EVENTS, its NOT WORKING !!!

    i really need help for solving this issue !!!

  • Hi imothep85!

    Well... That doesn't make any sense. I checked the site and it opens on both situations, if you put it as default or when you click a button, the other one Le Soir, doesn't open in any of those situations. So, I can only assume that someting at Le Soir is keeping you from opening it inside an iFrame. ... .capx?dl=1

    Check this example. I have a button for LeSoir and I'm trying to open it by default. None of those work. All other sites, including work fine. Note, also, that TED site will blow the iFrame and open itself out of the construct window and in the main browser window.


  • thanks im goign to see whats wrong with my events

  • My bet is that the problem is with some sites, not your events, but... Maybe both things are contributing to the problem. i can't say without checking your capx. Good luck!

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • here its my capx

    can you look at it?

    i cant click on my urls buttons and then open the iframe layout


  • Hey imothep85!

    Here's an adjusted capx. I added a loader, so the iFrame only shows after its content is fully loaded. ... .capx?dl=1

    Also, I checked the Le Soir site and it has, indeed, a http header called X-Frame-Options set to "sameorigin", which keeps it from being loaded in a frame that is not on the same site.

    Note: do not add events to the layAssets layout. It's a eventless layout that has the purpose of storing stuff that will be created dynamically, since Construct 2 needs at least one instance to exist so it can load an object. Think of it as an asset repository.

    Hope this helps. Cheers!

  • Thanks brunopalermo

  • imothep85 I did not read all the messages but I think brunopalermo already helped you, but in any case, this plugin is not mine.

    But it looks like it's a simple error in your code. You are always asking to go to the site, so it will never load. You can resolve by simply placing a trigger in the sub-event.


Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)