louis_coetzee Posted January 13, 2009 Share Posted January 13, 2009 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. Link to comment https://forums.phpfreaks.com/topic/140652-php-to-check-wether-javascript-is-enabled-or-not-and-perform-action/ Share on other sites More sharing options...
gevans Posted January 13, 2009 Share Posted January 13, 2009 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? Link to comment https://forums.phpfreaks.com/topic/140652-php-to-check-wether-javascript-is-enabled-or-not-and-perform-action/#findComment-736084 Share on other sites More sharing options...
louis_coetzee Posted January 13, 2009 Author Share Posted January 13, 2009 What type of client-side redirect? The one I would have used was Javascript, but since it's disabled it could cause a problem. Any ideas? ??? Link to comment https://forums.phpfreaks.com/topic/140652-php-to-check-wether-javascript-is-enabled-or-not-and-perform-action/#findComment-736086 Share on other sites More sharing options...
gevans Posted January 13, 2009 Share Posted January 13, 2009 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 Link to comment https://forums.phpfreaks.com/topic/140652-php-to-check-wether-javascript-is-enabled-or-not-and-perform-action/#findComment-736087 Share on other sites More sharing options...
louis_coetzee Posted January 13, 2009 Author Share Posted January 13, 2009 Thanks a lot, that solved my problem. Link to comment https://forums.phpfreaks.com/topic/140652-php-to-check-wether-javascript-is-enabled-or-not-and-perform-action/#findComment-736097 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.