devxlogo

How to Write Backward Compatible JavaScript Links

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:

 link

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

 link

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!

See also  How IoT Tech Will Transform Logistics
devxblackblue

About Our Editorial Process

At DevX, we’re dedicated to tech entrepreneurship. Our team closely follows industry shifts, new products, AI breakthroughs, technology trends, and funding announcements. Articles undergo thorough editing to ensure accuracy and clarity, reflecting DevX’s style and supporting entrepreneurs in the tech sphere.

See our full editorial policy.

About Our Journalist