Page 1 of 1
Opening ALL links in new window
Posted: Tue Jun 27, 2006 11:23 am
by dirgeshp
I am making a entire website and have already implemented everything...
the problem is i dont want to go to EVERY single link and add "target=_blank_"
so is there a way to make it so that EVERY link that a user clicks on in my website...it opens in a NEW WINDOW
please help
Posted: Tue Jun 27, 2006 11:25 am
by Luke
Sorry to ask a question w/out providing an answer, but WHY whould you want to do that??
Posted: Tue Jun 27, 2006 11:26 am
by Todd_Z
Check out the behaviour javascript library, that would probably be the easiest solution.
Posted: Tue Jun 27, 2006 11:38 am
by dirgeshp
Can you provide me with a link to that library
Posted: Tue Jun 27, 2006 12:02 pm
by bokehman
target is depracated. W3C recommends Javascript for that. Add the following to the <a> elements.
Code: Select all
onclick="return !window.location(this.href)"
For accessibility you should also add an identical event handler "
onkeypress" for people not using a pointing device.
Posted: Tue Jun 27, 2006 12:11 pm
by RobertGonzalez
Not to try to sell you on a different idea, but there is
an interesting article on Sitepoint regarding opening new windows with hyperlinks.
If you must open new windows, use JavaScript instead of the depricated (and XHTML non-comliant) target="_blank" attribute.