DISQUS

Tech-Recipes: Opening Links In a New Window | HTML | Tech-Recipes

  • Anonymous · 5 years ago
    Hello Alex,

    There are two things I'd like to say. First, forcing users into a new window can be good if you want them to see information on another site without them leaving yours. Of course, when they're done on the "popped-up" site and close the window, they'll be back on your site!

    Second, there's actually a better way to force this new window if you are using XHTML 1.0 or higher code. Simply putting target="_blank" in your anchor DOES work, but it does NOT validate with the W3C. The preferred way is to add a little javascript like this:
    <a onclick="this.target='_blank';" href="http://www.tech-recipes.com">Tech-Recipes.com


    That will do it, AND will validate.

    Cheers,

    Chris
  • ACPRathore · 4 years ago
    it was a stroke of good luck tht i found the html code to open links in new windows here. thanx to AlexTheBeast. although he says he hates this standard method, it proved very useful for me