Skip to main content
Post Made Community Wiki by Erik Reppen
Source Link
GavinH
  • 666
  • 6
  • 9

You mentioned using onlick attributes. Are you planning on using a JavaScript event handler for page navigation?

I would recommend against this for a single reason: it breaks middle clicking.

For regular link clicking, assuming JavaScript is enabled, these will be functionally equivalent:

<a href="#" onclick="window.location = 'myPage.htm';">Click here</a>
<a href="myPage.htm">Click here</a>

If you try to middle click the first example, you'll get a blank page rather than myPage.htm.

Apart from this example, I think it's ok to use obtrusive JavaScript if it makes business sense for you. It takes less time to write (but not necessarily maintain) inline JavaScript, and the loss of progressive enhancement might not be important in your situation.