开发者

Waterproof method to block non-javascript users

开发者 https://www.devze.com 2023-03-29 05:14 出处:网络
Is there a waterproof method to block users that have disabled JavaScript in their browser? If I do a check with cookies, a user can add a cookie manually.

Is there a waterproof method to block users that have disabled JavaScript in their browser?

If I do a check with cookies, a user can add a cookie manually.

I need this check because a JavaScript JQuery popupwindow should always be displayed, even when JavaScript is disabled开发者_如何学JAVA.


You can use noscript tag in your html with a redirect like this:

<noscript>
    <meta http-equiv="refresh" content="0;url=no-js.html" />
</noscript>

This way, if a user has disabled javascript, then he/she will be redirected to the no-js.html page, which you can customise as you please.


Use the no script tag

to display a huge div that will block the page, or trigger a redirect with ?

still it sounds like a hacky method, perhaps you should use the noscript tag to display a message that JS should be activated for the full experience and functionality?


You could set certain elements, like a log-in perhaps, to display: none with CSS. With JavaScript, simply remove that style.

Or you can use this.

0

精彩评论

暂无评论...
验证码 换一张
取 消