Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 8 of 8
  1. #1
    New to the CF scene
    Join Date
    Aug 2005
    Posts
    1
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Unhappy Can you force new browser window for hyperlinks?

    Hi,
    I am using iframe in html pages. iframe basically gets data from database which may contain hyperlinks. My problem is any links within the iframe display the link-destination pages within the iframe. Also the data is input by the visitors have no idea on how to set target in hyperlink tag.


    Is there a way via CSS or some other way to force any clicks on iframe links to open new browser window? Basically i want the customers open up new window for their any custom hyperlinks displayed in iframe.

    thanks in advance for any help.
    Nimish

  • #2
    Regular Coder Lerura's Avatar
    Join Date
    Aug 2005
    Location
    Denmark
    Posts
    946
    Thanks
    0
    Thanked 129 Times in 128 Posts
    You can insert one of these lines in your <head>

    Code:
    <base target="_blank">
    which opens any link, that do not have target , in a hole new window.
    or
    Code:
    <base target="something">
    which opens the first clicked link in a new window and when you click another link it will open in the same window as the first



    if this doesn't work try providing a link to your page so i can have a look at it

  • #3
    Regular Coder Ranger56's Avatar
    Join Date
    Mar 2005
    Location
    Kent, WA.
    Posts
    783
    Thanks
    0
    Thanked 0 Times in 0 Posts
    <base> is most likely depracated.

    just use this in any links in your iframe.

    <a href="blach.html" targer="_blank">LINK</a>

    But remember, the 'target' attribute is not valid in xhtml.

  • #4
    Senior Coder gsnedders's Avatar
    Join Date
    Jan 2004
    Posts
    2,340
    Thanks
    1
    Thanked 7 Times in 7 Posts
    Quote Originally Posted by Ranger56
    But remember, the 'target' attribute is not valid in xhtml.
    In XHTML 1.0 Transitional it is...

  • #5
    Regular Coder Ranger56's Avatar
    Join Date
    Mar 2005
    Location
    Kent, WA.
    Posts
    783
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Quote Originally Posted by Error 404
    In XHTML 1.0 Transitional it is...
    Well...new windows are still really annoying.

  • #6
    Senior Coder gsnedders's Avatar
    Join Date
    Jan 2004
    Posts
    2,340
    Thanks
    1
    Thanked 7 Times in 7 Posts
    Quote Originally Posted by Ranger56
    Well...new windows are still really annoying.
    IMO it's hijacking the GUI

  • #7
    Regular Coder Ranger56's Avatar
    Join Date
    Mar 2005
    Location
    Kent, WA.
    Posts
    783
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Quote Originally Posted by Error 404
    IMO it's hijacking the GUI
    Kinda.

  • #8
    Regular Coder
    Join Date
    Jul 2005
    Location
    Halifax, Nova Scotia, Canada
    Posts
    392
    Thanks
    1
    Thanked 0 Times in 0 Posts
    I personally prefer it. There are some links on a page that obviously the user will not want to leave the page yet such as a pdf file. When I browse I hate forums and websites that do not open links externally. Sure you won't be able to validate as strict doctype... but it doesn't stop you from using the strict doctype anyway and if everything else validates I say go for it.

    target="_blank" is the easiest way to open a page in a new window, knock yourself out.
    Once I thought I was wrong but I was mistaken.


  •  

    Posting Permissions

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