<script type="text/javascript">
document.write("Welcome, you have Javascript on.")
</script>
<noscript>JavaScript is off. Please enable to view full site.</noscript>
If JavaScript is on the user gets a welcome message. If off, the user is instructed to turn it on.
You could also simply add a link with instructions on how to turn on JavaScript in the noscript tag.
<noscript>For full functionality of this page it is necessary to enable JavaScript. Here are the <a href="http://www.enable-javascript.com" target="_blank"> instructions how to enable JavaScript in your web browser</a></noscript>
@Toni Podmanicki Thanks for the useful link
Nice snippet. Thanks for sharing.
But, isnt it supposed to show the notification on a pop up instead of site upper header?
Thanks
That would require Javascript, which if the reader has it disabled then you can’t give an alert like that.
I think it’s better in this way. An in-page message could be less annoying than a popup.
Thank you for this very useful snippet. :)
Thanks for this one. Love this snippet
It doesn’t work if your site is at jimdo.de.
My script for my site:
document.getElementById(“JavaS”).innerHTML = “Welcome, you have Javascript on.”;
For full functionality of this page it is necessary to enable JavaScript. Here are the instructions how to enable JavaScript in your web browser.
Great job.. Thanks alot. -Steven
how would you delete any other content in the page?