Use C # code to modify the Script status of FF and IE

Source: Internet
Author: User

How to use code to set operations in IE and FF to change the Script or JavaScript status in IE, whether it is disabled or enabled. The following articles do not support other browsers.

 

Currently, two solutions are available (IE is used as an example)

First, use an automated tool to capture the process id of IE, capture the files, tools, and menu items of IE, click and capture them step by step, and then click and save them.

Second, write code, modify existing resources that can be changed, and read and modify the status.

For the above two solutions, this article only implements the latter because the automation tools required by the former are hard to determine. Even if it is determined, it takes some time to configure the environment and read the documentation, familiar with those dll and so on, this will take a lot of time. The latter solution saves time.

 

IE

Registry details: http://support.microsoft.com/kb/182569

Some of the following content is mentioned in the Registry key description of Internet Explorer, so we can modify the options in the Registry to meet our expectation.
Vcj0 = "# ff0000"> // <summary>
/// Get Current Script state of IE.
/// </Summary>
/// <Param name = "regPath"> </param>
/// <Returns> true ---> allow Script. </returns>
Public static bool GetIECurrentScriptState (string regPath)
{
Bool ret = false;
RegistryKey regSubkey = null;
RegSubkey = Registry. CurrentUser. OpenSubKey (regPath, true );
If (regSubkey. GetValue ("1400"). ToString () = "0 ")
{
Ret = true;
}
If (int) regSubkey. GetValue ("1400") = 3)
{
Ret = false;
}

Return ret;
}

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.