Jump to content

Detecting compatibility


Azu

Recommended Posts

Can you please tell me how I can detect whether or not the client supports javascript? So that if it doesn't support it, I can have PHP do something?

 

 

P.S. I need to know BEFORE headers from my server to the client, not afterwards.

Link to comment
Share on other sites

the noscript html tag will show whatever html is in it if there is no js or if js is turned off:

<noscript>Please turn javascript on in your browser to use this web site</noscript>

only runs when the page is parsed by the browser though.

 

The only way the server can know whether the client has js on or not is by first loading  a page into the client and then communicating it back to the server like through a meta refresh(yuck).

 

Bottom line - no information about whether js is on or not is sent to the server in the headers in the request from the browser to the server! It ain't in there.

Link to comment
Share on other sites

  • 4 weeks later...

Thanks ^^ the whole reason I am planning on using javascript though is to save bandwidth. I want to use external javascript to show my navigation menu, so it doesn't need to be downloaded over and over (which it should only do if javascript isn't supported) so I'd really appreciate it if there was some way to tell whether or not the client supports javascript. I guess I could include a javascript in every page that sends something to my server, and check on every page view if it was received or not, and store all the results in a mysql table, and then query the mysql every time a page is loaded to know whether or not javascript is supported, but this would put more load on the server, so I am looking for a way to quickly tell if it is on or off.. :o

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.