Search code examples
internet-explorerregistry

How to disable javascript programmatically


I can disable java script in internet security in IE. But how do I do it programmatically? Like using registry keys?


Solution

  • In C# you can do it like this -

    private void UpdateDataSource()      
        {         
            RegistryKey ChangeSettings = Registry.CurrentUser.OpenSubKey(@"Software\\Microsoft\\Windows\\CurrentVersion\\Internet Settings\\Zones\\3", true); 
    
            // "Active Scripting" - "Disable"          
            ChangeSettings.SetValue("1400", "3", RegistryValueKind.DWord);          
    
            ChangeSettings.Close();    
        }
    

    //------ Or Using Simple Command in CommandPrompt ------//

    REG ADD "HKCU\Software\Microsoft\Windows\CurrentVersion\Internet Settings\Zones\3" /t REG_DWORD /v 1400 /d 3 /f
    

    Note : To enable use -> /d 0 in CommandPrompt

    OR

    "1400", "0" in C#