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
精彩评论