Search code examples
javascriptphpnoscript

check noscript and log this status to db


On web page, I want to check whether the user has no script available.

Just after the check, I want to write something on php code (like put some log in db).

I have checked on some sites, such as: PHP & <noscript> combination to detect enabled JavaScript in browser

and Check whether Javascript is enabled but the problem is, that the server side will have $_COOKIE or $_SESSION set as wanted (for the check) only after the page is reloaded again.

I want to check on php, that the client doesn't support javascript, just on first clicking the page (no need clicking it twice).

How can I do that?

Thanks :)


Solution

  • In the noscript section you could load a resource from your server. If the a visitor loads the resource, you know that he has JavaScript disabled.