dmolsen / Detector

Detector is a simple, PHP- and JavaScript-based browser- and feature-detection library that can adapt to new devices & browsers on its own without the need to pull from a central database of browser information.
http://detector.dmolsen.com/
MIT License
847 stars 80 forks source link

Detecting JS support #22

Closed CMCDragonkai closed 11 years ago

CMCDragonkai commented 11 years ago

What would be a good way to detect whether the browser runs javascript? I know of course the modernizr won't run at all if JS was disabled, but does the server side library have a function to let me know whether it received data from modernizr?

dmolsen commented 11 years ago

Yes. If there is no JS there is a meta refresh tag that runs and sets a request var called nojs to true. Something similar happens if cookies aren't supported.

CMCDragonkai commented 11 years ago

Does this happen on the first page load, or on the second page load? Because if my server side can detect it on the first page load (before output is sent), that would be great!