May 2, 201313 yr Hi - I'm displaying an external website in an iframe. The links in the external website, which I have no control over, use the "_parent" target which opens the link location in a new window. I would like to force the links to open within the iframe. Is it possible to force this using javascript? Thanks
May 3, 201313 yr Hi. I don’t think you can target links in iframes with. JS. But you could open the entire external page in a small popup window with the window.open method. Then the links woud also open in the the same pop up.
May 3, 201313 yr I had a sudden thought about using PHP to include the external URL, but on second thoughts it wouldn't work.
May 3, 201313 yr I had a sudden thought about using PHP to include the external URL, but on second thoughts it wouldn't work. Nope PHP include woulden't work either. You would get duplicate html, body and head tags and even if it did you could not change the target attributes anyway. Loading the page with AJAX request is a nogo to because the content hosted externaly. I think the only way to do it is to copy the sourcecode paste it in a div and change the target attributes either manually or with JS. But I don't think google will aprove copied content. I still think the best solution is to use a window.open popup instead of the iframe.
May 3, 201313 yr Thanks for clarifying. I didn't think it would work but I thought id throw the idea out there.
Create an account or sign in to comment