Jump to content

PHP to check wether javascript is enabled or not and perform action


louis_coetzee

Recommended Posts

How can I check if javascript is enabled, if not redirect to errorjs.php else stay put. I have seen websites that detect this and redirect to error page. I am using ajax, so I do need javascript. Any help and advice will be appreciated.

I've done a quick search as I've never done this before myself. From what I can tell, you can find out if the browser being used supports javascript but not if javascript is enabled. But you could use <noscript> and a client side redirect?

I just got this as a rough example

 

<noscript>

<meta http-equiv="refresh" content="2; URL=your_php_error_page.php">

</noscript>

 

It's set to redirect after 2 seconds, you might want to put a message in the noscript tags telling your user their getting redirected and why

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.