Open link from Iframe in new window/tab?

by 5 replies
6
I have installed a php search engine on one of my sites which is viewed on several other pages using an iframe. My question is, once the search engine has listed the relevant pages, is it possible that when a page link is clicked it will automatically open in a new window or tab. I know this can be done on mass with wordpress just by installing a plugin, but can it be done with a php search results page?
#programming #iframe #link #open #window or tab
  • Edit the code to modify the links to open in a new window.
    • [1] reply
    • Easy for you to say. I wouldn't have a clue where to begin.
      • [1] reply
  • You would need to add some javascript to add the "target" attribute to the links you want to open in a new tab/window. And you would need to make sure that all such links had the same class or some attribute that you could use to identify them.

    Using the YUI 3 javascript library something like:

    Y.all('.links').setAttribute("target","_blank");

    And you would need to do this by accessing the iframe of course.
    • [1] reply
    • Thanks to everybody for trying to help, but I don't know enough to use it and have found another way to do want I wanted.

      Thanks again,

      Phill

Next Topics on Trending Feed

  • 6

    I have installed a php search engine on one of my sites which is viewed on several other pages using an iframe. My question is, once the search engine has listed the relevant pages, is it possible that when a page link is clicked it will automatically open in a new window or tab. I know this can be done on mass with wordpress just by installing a plugin, but can it be done with a php search results page?