admin管理员组文章数量:1421190
<noscript>
<div>
You must enable javascript to continue.
</div>
</noscript>
Ok this makes sense, but still, the contents after this element will be shown, of course in a bad way, but what I am looking for is this:
If javascript is NOT enabled, I want to show this alert message, and NOTHING ELSE, I don't want to give advice "It's better if you enabled Javascript", I want to FORCE, "You MUST ENABLED so you can Continue!", I don't wanna give access to my website if javascript is not enbaled, how can I do that?
<noscript>
<div>
You must enable javascript to continue.
</div>
</noscript>
Ok this makes sense, but still, the contents after this element will be shown, of course in a bad way, but what I am looking for is this:
If javascript is NOT enabled, I want to show this alert message, and NOTHING ELSE, I don't want to give advice "It's better if you enabled Javascript", I want to FORCE, "You MUST ENABLED so you can Continue!", I don't wanna give access to my website if javascript is not enbaled, how can I do that?
Share Improve this question edited May 3, 2012 at 13:30 THelper 15.6k6 gold badges67 silver badges106 bronze badges asked May 1, 2012 at 17:48 Ali BassamAli Bassam 9,98924 gold badges70 silver badges119 bronze badges2 Answers
Reset to default 7Add a No-Javascript
CSS class that hides everything else using CSS, and use Javascript to remove the class immediately (using an inline <script>
block in that element).
<noscript>
<div style='position:fixed;left:0;top:0;width:100%;height:100%;background:#f55;z-index=1000">
You must enable javascript to continue.
</div>
</noscript>
Also, your question wanted to throw an alert.. Which is JavaScript. You basically asked "how can I execute JS when JS is disabled?". But this HTML alone will do the trick.
本文标签: Checking if browser is javascript enabled or notStack Overflow
版权声明:本文标题:Checking if browser is javascript enabled or not - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1745341471a2654281.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论