<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.
发布者:admin,转转请注明出处:http://www.yc00.com/questions/1745341472a4623346.html
评论列表(0条)