How to detect if JavaScript is disabled?

后端 未结 30 3477
暗喜
暗喜 2020-11-21 07:37

There was a post this morning asking about how many people disable JavaScript. Then I began to wonder what techniques might be used to determine if the user has it disabled.

30条回答
  •  太阳男子
    2020-11-21 07:53

    just a bit tough but (hairbo gave me the idea)

    CSS:

    .pagecontainer {
      display: none;
    }
    

    JS:

    function load() {
      document.getElementById('noscriptmsg').style.display = "none";
      document.getElementById('load').style.display = "block";
      /* rest of js*/
    }
    

    HTML:

    
    
      
    Page loading....
    You don't have javascript enabled. Good luck with that.

    would work in any case right? even if the noscript tag is unsupported (only some css required) any one knows a non css solution?

提交回复
热议问题