Best practice for users with javascript disabled?

Best practice for users with javascript disabled?

adamadam Posts: 11Questions: 0Answers: 0
edited February 2010 in General
Hi

I've been working on putting DataTables onto a data intensive site. Using the server side method with ajax works beautifully and the filter is awesome. Also, letting DataTables control the column ordering and page creation, my php is nice and lean.

My issue is when I turn javascript off. *Obviously* my ajax wont work and I get no results :D

I'm just wondering what the best practice is to cover these situations? It seems a shame to keep all that extra php in the file just in case a user has js disabled.

Is there a quick way to sniff out if js is disabled and then instead of querying the database via datatables/ajax, to just include the file in php and load it as usual...? Or other?

A lot of people recommend using AJAX and JavaScript as a progressive enhancement. But the number of users that turn off javascript now - or dont have it - is decreasing as time goes on. My mobile phone even has it now a days!

With more and more "web 2" widgets being released, there must be a standard method of covering these "disabled users".... :/

Replies

  • allanallan Posts: 63,498Questions: 1Answers: 10,471 Site admin
    Hi adam,

    Excellent question - I fully approve :-). DataTables was designed to progressively enhance tables, and actually the server-side processing was only really added as an after-thought (although obviously a lot of thinking went into it ;-) ) in v1.5. So you have a couple of options:

    1. Use NOSCRIPT to tell the user that they will not get the full 'experience' since they don't have Javascript. There is no way on the server-side to detect that they don't have Javascript. In fact, you can't really 'detect' the lack of Javascript and then act on it, since any actions would need Javascript!

    2. Put the first page (or provide HTML pagination controls for full support) into the table when the page loads Then when DataTables initialises for server-side processing, it will nuke this. This could be considered 'progressive enhancement'.

    It's very hard to get good statistics for how many people have Javascript off (again because the detection uses Javascript!) but W3Schools puts it at 10% at the moment. This can and will vary hugely based on your web-site's demographics thought.

    Regards,
    Allan
This discussion has been closed.