尝试使用bootstrap和noscript创建警报

时间:2015-10-07 17:41:34

标签: javascript noscript

我正在尝试为用户浏览器中禁用JavaScript的情况创建警报。我认为最好的方法是使用这样的引导程序可撤销警报:

 <noscript>
    <div class="alert alert-warning alert-dismissable">
        <button type="button" class="close" data-dismiss="alert"
                aria-hidden="true">
            &times;
        </button>
        Warning! JavaScript is disabled.  This site may not work properly without it.
    </div>
</noscript>

当我运行代码时,它只是打印出noscript标签内的所有内容,就好像它是文本一样。我该如何纠正?或者是否有其他方法可以检查他们是否使用JavaScript?

1 个答案:

答案 0 :(得分:1)

Bootstrap警报只需使用html和css即可正常运行,因此它们可以在<noscript>标记中使用。

首次关闭javascript时会发生这种情况。只需刷新页面几次。