+ 2
How can I test the presence of javascript without <noscript>
Withoit HTML tags pls
4 odpowiedzi
+ 3
Why do you want to avoid use of <noscript>?
The only reason I can guess, is the need to style (css) differently document (or part of it) regarding of presence or not of JS (if it's only to display a specific message in case of JS not available, <noscript> element is well designed for, even if you could follow @John Wells advice)... in this case, in same way as @John Wells advice, give default specific style for no JS, and with JS add dynamically a class name to the <body> element (or remove it), then define style for JS present by prepend the class name to the css rules you want to be applied when JS is present (or inverse):
<style>
p { color: blue; }
.js p { color: red; }
</style>
<body>
<p>default styled to blue, red if body get 'js' class name</p>
<script>
document.body.className = "js";
</script>
</body>
+ 3
Default the document to your message and use JS to change it. If they don't have it, they get your error message. Otherwise, they get your program.
+ 1
alert("Test - Yup, it's working!");
Basically, you can test it by doing anything that uses Javascript.
0
And if user dont have JS, how can i write something like "Bro, you don't have javascript"