Is Using JavaScript to Emulate Clicking an HREF a Bad Technique?

Arshad Tanveer just commented on my post Well Designed URLs are Beautiful!  Arshad felt I was being “a tad too harsh on links triggering JavaScript.” Well he was right; I was being harsh. But I was being harsh on purpose!

My reason for being harsh on using JavaScript instead of basic HTML hypertext was to make a strong point, and to have that point stand out among my other points. Yes, there are a few good reasons to use JavaScript to load another URLs content into the browser, but I would argue:

  1. Good reasons for using JavaScript in an <A> tag are few and far between, and
  2. The cases where there are good reasons can be eliminated by changing architecture, and will probably result in a better overall design.

That said, I’d like to offer this challenge to JavaScript devotes: Give me what you think are good uses of JavaScript triggering URLs, and I’ll do my best to I’ll explain how and/or why it would be better without JavaScript!

P.S. If you can provide website examples with URLs and or developer tools that use them, it will help me and my readers better understand the example.

2 Replies to “Is Using JavaScript to Emulate Clicking an HREF a Bad Technique?”

  1. One really good reason why you shouldnt use javascriptlinks is that searchengines like google cant follow them with the result that your website dont get indexed. Needless to say that for a company that uses the web for marketing it can be a disaster not getting the searchengines to index your site. The next step is to get a higher pagerank than your opponent on google making your site appear before the opponent in the searchresults.

Leave a Reply

Your email address will not be published.