How to Write Backward Compatible JavaScript Links

Although most people have JavaScript enabled on their browsers, there are still a lot of people who don’t. This is why you should always make your pages as backward compatible as possible. One easy way to improve access is with pop-up window links (where you click somewhere and a page appears in a small pop-up window). Usually, you’d write:


Instead, try using the onClick handler to handle the JavaScript:


The link will display the page in a new window for non-JS browsers and the “return false” ensures that newer browsers only perform the (more controllable) JavaScript pop-up. onClick=”return false;” can also be useful in stopping links from taking you to the top of the page, and of course they remain backward compatible!

Share the Post:
Share on facebook
Share on twitter
Share on linkedin


Recent Articles: