views:

60

answers:

3

Hi,

Currently many of the links on our pages get changed to href="javascript:void(0);" on pageload, but if you're impatient (as most users are) you can click the links before the page loads and land on the clunkier, non-javascript, non-ajax pages.

I'm thinking about progressive enhancement a lot these days, and I predict the majority of our users will have javascript enabled (no data yet, we havn't yet launched alpha)

Is it a bad idea to generate some indicator that a user has javascript enabled for the session, and then serve pages that assume javascript? (ie. have the server put href="javascript:void(0);" from the start)

A: 

Do you do your progressive enhancement on load? You could try to move it to (a cross-browser version of) DOMReady.

fforw
A: 

Couldn't you delegate this to the document, to keep your HTML clean?

For example, in jQuery:

$( document )
    .click( function(){ return false })
    .ready( function(){ $( this ).unbind( "click" ) } )
Jed Schmidt
+3  A: 

Why not just do

<a href="oldversion.htm" onclick="...something useful......; return false;">link</a>

return false tells the browser not to carry on to the url in the href.

Now js visitors get fancy js, and non-js users fall back silently and there is no need for changing links on pageload.

James
I totally forgot about that! good call mate :)
Jiaaro
I was changing the href attribute with the jquery dom ready function! I HAVE BEEN REMISS ;) haha
Jiaaro