<html> <head> <title>Example HTML Page</title> </head> <body> <noscript> <center><p style="color:red; font-size:26px;">本页面需要浏览器支持(启用)JavaScript</p></center> </noscript> <!-- 这里放内容 --> <script type="text/javascript"> alert(1); </script> </body> </html>
在以下两种情况下,上述代码<p>标记中的内容会显示出来:
- 浏览器不支持脚本
- 浏览器支持脚本,但脚本被禁用。
除此之外,用户在浏览器中永远看不到<noscript>标记中的内容。