Call external URL in same iFrame


#1

Dear hyper-ists,

perhaps I’m sitting in front of the solution but I don’t get it:

I’ve set up a hype-file with to buttons calling external URLs. As long as I open the hype-generated HTML-file directly everything’s fine.

BUT
as I embed the hype-file in an iframe (what I have to) clicking the links lead to a strange result:
Instead of only loading the external link into the iFrame the whole page disappears and the called URL loads.

How is it achieved to load the external URL only in the iframe so the rest of site stays?

Perhaps some js.-magic!?

Thanks for your help and best regards,
Tesla


#2

The inferred ‘target’ for a URL is ‘self’ which is the same frame in which it was clicked. So to open in the ‘parent’ of the frame (the outer frame in which a URL is embedded) you would need to manually create a link:

<a href="https://tumult.com" target="_parent">a link</a> or you can select ‘open in new window’ for the mouse click action.

You can use target="_self" to load the iframe in the same frame.


#3

Hi Daniel,
I just checked the “open in a new window” in “Go to new URL”-action but still the same: the whole site is reloaded, not only the content of the iframe.

How can I manually enter links into hype-documents?
Can I change to source-code in HYPE somewhere?

Thanks and beste regards,
Tesla


#4

You can create a link by selecting a rectangle and click Edit > Edit Inner HTML to insert HTML code like a link. Here’s more info on the target attribute: https://www.w3schools.com/tags/att_a_target.asp


#5

Thanks Daniel!

Edit innerHTML with naming the iframe

<iframe name="iframe1" src="target.html"></iframe>

and then targeting it in the link

<a href="link.html" target="iframe1" >link</a>

did the trick for my project.

Best,
Tesla