Possible Duplicate:
How to detect if JavaScript is disabled?
In my php application i need to check whether the javascript is turn on or not in browser. I have tried this <noscript><p>javascript is off<p></noscript>
it's working fine.But i need to redirect to a page if javascript is OFF so developed like this
<noscript>
<?php header('Location: index.php');?>
</noscript>
But i/ts always redirecting to index.php, there is any way to do this.
your solution clearly cannot work, since php is executed before the page is served on client
you could instead do something like
<noscript>
<meta http-equiv="refresh" content="0;URL='http://example.com/'">
</noscript>
in the head of your document
<noscript><meta http-equiv="refresh" content="1;url=error.html"></noscript>
try this to redirect if JS is disabled Php script runs independently of js
There are known issues with noscript
Instead do this:
<html>
<head>
<script>
window.location.href="javascriptEnabled.html";
/*Since javascript is enabled redirect to javascript based page*/
</script>
</head>
<body>
Showing Static Website since javascript is not enabled..
</body>
</html>
There is not a good way to do it, because without client side interactivity, you can not get information back from the client.
You could do something like this...
Therefore, if javasccript is enabled, you get to the javascript page, otherwise the non javascript page
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With