Results 1 to 3 of 3

Thread: How do I force links in an iframe to open a new window (different web site domain)?

  1. #1
    Join Date
    Mar 2005
    Location
    Western Australia
    Posts
    148
    Thanks
    24
    Thanked 4 Times in 4 Posts

    Default How do I force links in an iframe to open a new window (different web site domain)?

    I have been doing a fair bit of searching but so far I have not been able to get this to work for me.

    I am trying to force links in a iframe to open either in a new window (_blank) or the top main window (_top)

    I am trying to pull in a window from Redbubble and for all links to then open up in a new window or the top. I have got it to load where I want it to start displaying the content via the below css (for this specific page only thsu far)

    html code

    Code:
    <div id="rb-div">
      <iframe src="http://www.redbubble.com/people/michelle/works/3747892-fire-and-ice-siamese-cat-painting" id="rb-iframe" scrolling="no"></iframe>
    </div>
    css specific for this test iframe

    Code:
    #rb-div {width:100%;height:2000px;overflow:hidden;position:relative;}
    #rb-iframe {position:absolute;top:-1450px;left:0px;width:100%;height:3450px;}
    Cheers for your help

    GW
    1st rule of web development - use Firefox and Firebug
    2nd rule - see the first rule
    --
    I like Smilies

  2. #2
    Join Date
    Mar 2005
    Location
    SE PA USA
    Posts
    30,495
    Thanks
    82
    Thanked 3,449 Times in 3,410 Posts
    Blog Entries
    12

    Default

    There's nothing you can do unless you own the 3747892-fire-and-ice-siamese-cat-painting page or at least have control over how the links on it are coded to open. If you do, you can code them all to open as you like either globally (base target tag in the head of the page) or individually (target attributes for each link). These can also be coded using javascript, but again one needs access to the page. Same origin policy security feature of today's browsers prevents the top page from having any javascript control over the page in the iframe unless they are from the same domain.
    - John
    ________________________

    Show Additional Thanks: International Rescue Committee - Donate or: The Ocean Conservancy - Donate or: PayPal - Donate

  3. #3
    Join Date
    Mar 2005
    Location
    Western Australia
    Posts
    148
    Thanks
    24
    Thanked 4 Times in 4 Posts

    Default

    Bugger , but thanks for the reply
    1st rule of web development - use Firefox and Firebug
    2nd rule - see the first rule
    --
    I like Smilies

Similar Threads

  1. Force a web page to open in new window/tab???
    By spiper in forum Looking for such a script or service
    Replies: 4
    Last Post: 01-21-2013, 02:43 PM
  2. Force URL to open as IFrame in outside URL
    By MJensen in forum JavaScript
    Replies: 80
    Last Post: 01-14-2008, 10:25 PM
  3. Open links in new window
    By hask23 in forum Dynamic Drive scripts help
    Replies: 4
    Last Post: 08-10-2006, 10:31 PM
  4. Replies: 0
    Last Post: 07-18-2006, 05:17 AM
  5. Open Links in New Window
    By bfboy in forum Dynamic Drive scripts help
    Replies: 2
    Last Post: 08-01-2005, 01:43 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •