Question

I'm using <noscript> to show, in some cases, alternate content and, in other cases, alternate pages when JavaScript is disabled.

<noscript><meta http-equiv="refresh" content="1;url=index-alt.php"></noscript>

I'm using the Firefox plugin to enable/disable JavaScript for testing, but the effect is the same when using the Edit > Preferences option in Linux FF.

Basically, when JS is re-enabled, the alternate page (eg, index-alt.php) remains, and I'm stuck on that page. I guess I really didn't consider this all that much after I implemented it and that was a mistake.

Is there a enable/disable JavaScript event I can bind to refresh my page to the default?

Was it helpful?

Solution

Once you have re-enabled JavaScript, you would need to return to the original page to test the page with script enabled.

If you are worried about this happening "in real life", you could have a script tag on the no-script page that redirects to the script page, which would do the inverse of your noscript tag:

document.location.href = "/index.php";
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top