Search code examples
javascriptgetelementbyidbrowser-securityblocked

JavaScript getelementbyid problem


When we use getelementbyid in JS the browser ask to allow or block the script, is there a piece of script to automatically allow that or avoid that or is there an alternative for that


Solution

  • If "the browser" is IE and you are viewing the file locally, this is because IE blocks JavaScript by default in local HTML as a security measure.

    If "the browser" is Firefox (very unlikely), this is because netscape.security.PrivilegeManager.enablePrivilege was called. Never call that function.