Javascript switch on / off

What is the best way to toggle the warning "Please enable Javascript"?

I currently have something like this:

<div id='JSwarning'>ONLY SQUARES DON'T USE JAVASCRIPT</div>

to which I then apply .style.display = "none".

This shows a warning on each page for a while until it loads. There should be a more elegant way. Can I do this using PHP?

(BTW get_browser()is not the solution I'm looking for.)

// EDIT

Thanks to everyone that does the trick. By the way, in order to check the page (XHTML 1.0 Strict), I needed to place the child element of node (s) in the block container.

+3
source share
5 answers
<script></script>
<noscript>Please enable Javascript.</noscript>

http://www.w3.org/TR/REC-html40/interact/scripts.html#h-18.3.1

+3

, noscript:

<noscript>ONLY SQUARES DON'T USE JAVASCRIPT</noscript>

, , js ( ).

+2

noscript

<script language="javascript">
    document.write("Hello World!");
</script>
<noscript>
    You need to enable javascript to view this page!
</noscript>
+2

DomContentLoaded? <noscript>, , .

+1

- .... , .

JavaScript . . . JS ( ). JS (, Firefox NoScript).

.

0

Source: https://habr.com/ru/post/1773203/


All Articles