JS implementation Add Trusted sites, modify ActiveX security settings, disable Pop-up Blocker _javascript tips

Source: Internet
Author: User
Tags ranges

To satisfy the need to add a site to a trusted site, use the system's controls to not prompt the user when the window pops up. This can be done in the following ways:

First, look at the values and meanings you can set.

Record of registry entries for trusted sites

HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Internet Settings\zonemap\ranges\range[*]

Record of registry entries for ActiveX controls

HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Internet Settings\zones\[0-4]\[*]

Meaning Description:

The meaning of the ActiveX control setting value: 3 is disabled, 0 is enabled, 1 is prompt

Meaning of the directory [0-4] in the registry key

value Set up
0 My computer
1 Local Intranet Zone
2 Trusted Sites Zone
3 Internet Zone
4 Restricted Sites Zone

Meaning of [*] in the registry key

value Set up
1001 Download a signed ActiveX control
1004 Downloading an unsigned ActiveX control
1200 Running ActiveX controls and Plug-ins
1201 Initialize and script ActiveX controls that are not marked as safe
1405 Execute scripts on ActiveX controls marked as safe to execute scripts
2201 ActiveX Control Auto Prompt *

Registry key for Pop-up Blocker

Hkey_current_userhkcu\software\microsoft\internet Explorer\New Windows\popupmgr

The specific script is as follows:

<script language= "JavaScript" > <!--var wshshell=new activexobject ("Wscript.Shell"); Add a trusted site or IP wshshell.regwrite ("Hkcu\\software\\microsoft\\windows\\currentversion\\internet Settings\\ZoneMap\\
 Ranges\\range100\\ "," "); WshShell.RegWrite ("Hkcu\\software\\microsoft\\windows\\currentversion\\internet Settings\\ZoneMap\\Ranges\\
 Range100\\http "," 2 "," REG_DWORD "); WshShell.RegWrite ("Hkcu\\software\\microsoft\\windows\\currentversion\\internet Settings\\ZoneMap\\Ranges\\
 Range100\\:range "," www.jb51.net "); WshShell.RegWrite ("Hkcu\\software\\microsoft\\windows\\currentversion\\internet Settings\\ZoneMap\\Ranges\\
 Range101\\ "," "); WshShell.RegWrite ("Hkcu\\software\\microsoft\\windows\\currentversion\\internet Settings\\ZoneMap\\Ranges\\
 Range101\\http "," 2 "," REG_DWORD "); WshShell.RegWrite ("Hkcu\\software\\microsoft\\windows\\currentversion\\internet Settings\\ZoneMap\\Ranges\\
 Range101\\:range "," www.example.com "); Modify IE ActiveX security settings wshshell.regwrite ("hkcu\\software\\microsoft\\Windows\\currentversion\\internet settings\\zones\\3\\1001 "," 0 "," REG_DWORD "); WshShell.RegWrite ("Hkcu\\software\\microsoft\\windows\\currentversion\\internet Settings\\Zones\\3\\1004", "0", "
 REG_DWORD "); WshShell.RegWrite ("Hkcu\\software\\microsoft\\windows\\currentversion\\internet Settings\\Zones\\3\\1200", "0", "
 REG_DWORD "); WshShell.RegWrite ("Hkcu\\software\\microsoft\\windows\\currentversion\\internet Settings\\Zones\\3\\1201", "0", "
 REG_DWORD "); WshShell.RegWrite ("Hkcu\\software\\microsoft\\windows\\currentversion\\internet Settings\\Zones\\3\\1405", "0", "
 REG_DWORD "); WshShell.RegWrite ("Hkcu\\software\\microsoft\\windows\\currentversion\\internet Settings\\Zones\\3\\2201", "0", "
 REG_DWORD ");
 Disables Pop-up Blocker wshshell.regwrite ("Hkcu\\software\\microsoft\\internet explorer\\new windows\\popupmgr", "no");
Alert ("Trusted Site Settings, ActiveX control security settings, successful pop-up settings"); --> </SCRIPT>

Like adding www.jb51.net to the customer's trusted site

1. Open the registry (run Regedit), first turn on the following directory

HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Internet Settings\ZoneMap\Domains

2. Create a new item in the table of contents: "Jb51.net"

3. Create a new item under Jb51.net: "www"

4. Under the WWW new key a Double-byte subkey: "*" (means any protocol, or set to: "http", "FTP" and so on a single protocol)

5. Double-click the newly created Double-byte subkey "*" to ensure that the base selection is "hexadecimal" in the numeric data type "2" (for Trusted sites)

6. Close the Registry

<script language= "JavaScript" >
<!--
 var wshshell=new activexobject ("Wscript.Shell");
 WshShell.RegWrite ("Hkcu\\software\\microsoft\\windows\\currentversion\\internet Settings\\ZoneMap\\Domains\\ Jb51.net "," ");
 WshShell.RegWrite ("Hkcu\\software\\microsoft\\windows\\currentversion\\internet Settings\\ZoneMap\\Domains\\ Jb51.net\\www "," ");
 WshShell.RegWrite ("Hkcu\\software\\microsoft\\windows\\currentversion\\internet Settings\\ZoneMap\\Domains\\ Jb51.net\\www\\http "," 2 "," REG_DWORD "
 );
 Alert ("successfully writes Jb51.net to a trusted site");
-->
</SCRIPT>

The above JS implementation to add a trusted site, modify ActiveX security settings, disable Pop-up Blocker is a small series to share all the content, I hope to give you a reference, but also hope that we support the cloud habitat community.

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.