Search code examples
javascriptserver-sideprogressive-enhancement

progressive enhancement on the server side?


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)


Solution

  • Why not just do this?

    <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.