开发者

jQuery or PHP code tell the visitor if Javascript is disabled

I want jQuery or PHP code tell the visitor if the Javascript is disabled. 开发者_如何学编程How to do that?


To tell the visitor if javascript is disabled you can just add a message in a <noscript> tag: e.g.

<noscript>Javascript is disabled!</noscript>

The message will only appear if javascript is disabled.


Here's an alternative to using <noscript>:

HTML:
    <div id='no-javascript'>Hey, you don't have javascript!</div>
    ...
    <script type='text/javascript'>
     $("body").addClass("js"); 
    </script>

CSS:
#no-javascript {color:red;}
body.js #no-javascript {display:none;}


No JQuery possible if javascript is disable

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜