I want to redirect the user to a certain page if he/she has javascript disabled. I tried this code:
<noscript><?php url::redirect('controller/method'); ?></noscript>
// url::redirect is much like the location header
to no avail...
How do I do this?
Since the headers have already been sent, you'll need to use standard HTML markup:
<noscript>
<meta http-equiv="refresh" content="0;url=noscript.html">
</noscript>
Trying this on both Firefox and IE seems to work well... With JavaScript enabled, the <meta>
tag is ignored. When it is disabled, the browser redirects to noscript.html
.
There is no way to do a redirect based on if javascript is disabled. Why not do the opposite - redirect if javascript is enabled?
<script>
window.location = "...";
</script>
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