HTML 判断是否禁用了 JS

HTML JavaScript About 707 words

noscript

<head></head>中使用自带<noscript></noscript>标签,可有浏览器识别。如果禁用了JS则执行noscript中代码。

示例

添加页面标签元素提示

<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>

    <noscript>
        <div>
            你禁止了JS
        </div>
    </noscript>
</head>
<body>

This is content

</body>
</html>

重定向到指定页面提示

<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>

    <noscript><meta http-equiv="refresh" content="0; url=https://www.baidu.com" /></noscript>
</head>
<body>

This is content

</body>
</html>
Views: 2,708 · Posted: 2020-11-27

————        END        ————

Give me a Star, Thanks:)

https://github.com/fendoudebb/LiteNote

扫描下方二维码关注公众号和小程序↓↓↓

扫描下方二维码关注公众号和小程序↓↓↓


Today On History
Browsing Refresh