Working on a website with iframes. Some links, if you choose “Open in new tab” will only open the iframe contents.
EDIT: if they right click and choose open a new window I want it to display in a new tab exactly the same thing that would be displayed if they just clicked on the link.
We’d like the user to be able to right click on any link and choose open in new window, and then display that Target in a new tab. Actual behavior is that it displays only part of the page in the new tab. My understanding is it’s displaying the contents of the iframe page on the new tab.
I’m wondering if there is an easy way to “hijack” (on the desktop called “subclass”) the Open In New Tab menu so that we can change the link, so that we supply our own link for that menu selection.
7
There is no easy or difficult way to do what you describe. But there are ways to achieve the same effect. The simplest ways would be have every link in the iframe redirect through the parent page.
<a href=“/parentpage.html?iframe=/newChildPage.html” target=“top”>link</a>
You would then need a little bit of code either server or client side to update the iframe to the passed in child page.
Taking this one step further and you could add some JS to the link to intercept the click and have the iframe go direct to the new child page.
<a
href=“/parentpage.html?iframe=/newChildPage.html”
target=“top”
onclick=“location.href=this.src.split(‘=‘)[1];return false”
>link</a>
Now when the link is click the iframe will go directly to the new page, and open in new tab will load it via the parent page.