Results 1 to 4 of 4

Thread: XHTML - target="_blank"

  1. #1
    Join Date
    Aug 2005
    Posts
    174
    Thanks
    3
    Thanked 0 Times in 0 Posts

    Default XHTML - target="_blank"

    Hello,

    Just wondering whats the best alternative to target="_blank" on XHTML strict webpages?

    I know of a few alternatives using javascript, is there any other option? Also, is it possible to open a new tab using javascript? and if the user's browser doesnt support tabs, it would open a new window?

    Thanks for your help..

  2. #2
    Join Date
    Feb 2008
    Location
    Cebu City Philippines
    Posts
    1,160
    Thanks
    17
    Thanked 277 Times in 275 Posts

    Default

    target="_blank" will validate only on transitional DTD.

    If you're wanting it to validate, then your best bet would be JS (window.open()).

    ...and if user's have JS disabled, give them the option to decide - they'll surely click the link, or do right-click and "open a new tab".
    Learn how to code at 02geek

    The more you learn, the more you'll realize there's much more to learn
    Ray.ph!

  3. #3
    Join Date
    Jun 2005
    Location
    英国
    Posts
    11,876
    Thanks
    1
    Thanked 180 Times in 172 Posts
    Blog Entries
    2

    Default

    This was removed from the specification because you shouldn't have control over the windows that appear on the user's desktop. If the user wants to open a new window or tab, then let the user right-click your link and choose to open one.

    I wouldn't use XHTML on the Web right now — IE does not support it and will display a download dialogue box instead of rendering your page.
    Twey | I understand English | 日本語が分かります | mi jimpe fi le jbobau | mi esperanton komprenas | je comprends franšais | entiendo espa˝ol | t˘i Ýt hiểu tiếng Việt | ich verstehe ein bisschen Deutsch | beware XHTML | common coding mistakes | tutorials | various stuff | argh PHP!

  4. #4
    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 are many alternatives to target="_blank". But, just as there are so many reason that one might want to use it in the first place, there are many alternatives. In many, many cases, one should as Twey says just let the user decide. However, there are good alternatives in cases where, say - you want to pop up some content for aesthetic reasons. As long as you do so in a way that will allow the non-javascript enabled user to navigate to any important content presented in this way, some sort of modal window like Lightbox may be good, in fact preferable.

    What exactly are you doing?
    - John
    ________________________

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

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
  •