0

Im trying to control the navigation of a secure website inside an iframe using links but it keeps opening in a new tab or window. It works normally in a nonsecure website. Here's my code:

<a href="#" onclick=window.open("https://www2.ecinteractiveplus.com/0463/Product/OND/VBD50BK/","iframe1");>Binders</a>
<a href="#" onclick=window.open("https://www2.ecinteractiveplus.com/0463/Product/UPG/BLU113/","iframe1");>Folders</a>

<iframe name="iframe1" src="https://www2.ecinteractiveplus.com/0463" style="min-height: 1100px;height:100%; min-width: 600px; width:100%;"></iframe>

Any help is greatly appreciated!

1 Answers1

1

This will work, just make sure iframe's javascript code loads from the same origin.

<a href="https://www2.ecinteractiveplus.com/0463/Product/OND/VBD50BK/" target="iframe1">Binders</a>
<a href="https://www2.ecinteractiveplus.com/0463/Product/UPG/BLU113/" target="iframe1">Folders</a>

<iframe name="iframe1" src="https://www2.ecinteractiveplus.com/0463" style="min-height: 1100px; height:100%; min-width: 600px; width:100%;"></iframe>
MrcRjs
  • 397
  • 5
  • 16
  • Hi, Thank you for the help but it still didnt work. Tested here: jsfiddle.net/c09rL1z4 – SkyEdge Jul 23 '18 at 23:19
  • That code works, it is opening in a different window because "you can't access an – MrcRjs Jul 23 '18 at 23:33
  • That explains everything. Do you have any alternative suggestion for this? Thanks a bunch! – SkyEdge Jul 23 '18 at 23:54
  • Well under development if you are using linux/unix you can edit your /etc/hosts file and change localhost to the domain you need, under production just make sure to run the application on the same origin, in my answer there's a link to same origin policy docs. – MrcRjs Jul 24 '18 at 00:14
  • Got it. Thank you! – SkyEdge Jul 25 '18 at 14:35