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,434
  • 16
  • 54
  • 74
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,010
  • 2
  • 49
  • 67
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,887
  • 1
  • 20
  • 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,462
  • 4
  • 33
  • 55