1

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?

4

1 回答 1

1

重新启用 JavaScript 后,您需要返回原始页面以测试启用脚本的页面。

如果您担心“在现实生活中”会发生这种情况,您可以在无脚本页面上有一个脚本标签,该标签重定向到脚本页面,这将与您的无脚本标签相反:

document.location.href = "/index.php";
于 2013-02-06T21:54:29.593 回答