1

I am developing a web application such a way that my codes dynamically generating JavaScript functions using php. If JavaScript is disabled in my client side, my application will not work properly. So I should inform my clients that JavaScript is not enabled in their browser. Is it possible to check using php code?

Code Lღver
  • 15,573
  • 16
  • 56
  • 75
Javad Shareef
  • 496
  • 7
  • 18
  • possible duplicate: http://stackoverflow.com/questions/121203/how-to-detect-if-javascript-is-disabled – Rene Pot Jan 10 '12 at 10:40
  • check the url [How to detect if JavaScript is disabled?][1] that is similar to your [1]: http://stackoverflow.com/q/121203/1035257 – Code Lღver Jan 10 '12 at 10:48

3 Answers3

4
<noscript> Please enable js</noscript>
stecb
  • 14,478
  • 2
  • 50
  • 68
2

Nope, not directly since the PHP code will be evaluated at a server level. It is only possible at clientside, using the <noscript /> HTML tag.

You could try the get_browser method (see php.net), but it is not 100% reliable.

Kolky
  • 2,917
  • 1
  • 21
  • 42
2

It's not possible directly using PHP - the solution by stecb is a client side solution which will display a message if javascript is not enabled.

Matt Fellows
  • 6,512
  • 4
  • 35
  • 57