检查Javascript是否启用

2021-12-29 00:00:00 jquery php javascript zend-framework

有没有办法检查浏览器是否启用或支持Javascript?如果不支持,我想将用户重定向到用户友好的错误页面.

Is there a way to check whether Javascript is enabled or supported by the browser? If it's not supported, I would like to redirect the user to a user-friendly error page.

我使用 jQuery 和 PHP Zend 框架.

I am using jQuery and the PHP Zend Framework.

推荐答案

<noscript><meta http-equiv="refresh" content="1;url=error.html"></noscript>

如果脚本被禁用,这将重定向到错误页面.只需将 error.html 替换为错误页面的 URL.

This will redirect to an error page if script is disabled. Just replace error.html with the URL of your error page.

相关文章