How can I execute Javascript function before Page load?

前端 未结 4 521
清歌不尽
清歌不尽 2020-12-18 00:48

I am using a hidden field \'Isjsenabled\' to detect whether Client\'s Javascript is enabled or disabled. If Javascript is enabled, Javascript function will be fired and it w

4条回答
  •  执笔经年
    2020-12-18 00:48

    Without thinking too hard about the direction you're trying to go in, there is a little used tag that is supported by all browsers called NOSCRIPT.

    
    

    As you can see, the idea is to make the browser request an image but only if javascript is disabled. This page could set a session variable stating that the current client has no script capability that would be available to all code in the current session.

    Or, you could follow your current methodology:

    
    
    

    Hope this helps,

    -Oisin

提交回复
热议问题