Is there a JavaScript function to tell me if JavaScript is turned on or not? something like this one:
<script>
if (true) {
document.write("JavaScript is turned on!");
}
</script>
Is there a JavaScript function to tell me if JavaScript is turned on or not? something like this one:
<script>
if (true) {
document.write("JavaScript is turned on!");
}
</script>
If it is enabled, the code runs. If it is not enabled the code does not run. There is nothing that is sent to the server that tells you if it is enabled.
Have you looked at the noscript element?
You should just use the noscript tag
<noscript>
Enable javascript man!
<noscript>
Or:
<script>
document.write("Hello World!")
</script>
<noscript>Your browser does not support JavaScript!</noscript>