Delphi Force WebBrowser control to display Web pages with a specified version

Source: Internet
Author: User
Tags hosting

function TFrmmain.WriteAppNameToReg:Boolean; var reg:tregistry; spath,sappname:string; sver:string;      Lenver:integer;begin result:=true;    Reg:=tregistry.create; Try Reg.        Rootkey:=hkey_local_machine;        spath:= ' Software\Microsoft\Internet explorer\main\featurecontrol\feature_browser_emulation '; If IsWin64 then spath:= ' Software\wow6432node\microsoft\internet explorer\main\featurecontrol\feature_browser_emula        tion '; If Reg.         Openkey (spath,true) THEN begin Sappname:=extractfilename (Application.exename);         SVER:=GETIEVERSIONSTR;         Lenver:=strtoint (Leftstr (Sver, Pos ('. ', Sver)-1)); If not Reg. Valueexists (sappname) Then if Lenver<=7 then Reg. Writeinteger (sappname,7000) Else if Lenver=8 then BEGIN Reg. Writeinteger (sappname,8000) End else if Lenver=9 then BEGIN Reg.          Writeinteger (sappname,9000) End else if lenver=10 then BEGIN Reg. Writeinteger (sappname,10000) End else if lenver=11 then BEGIN Reg.        Writeinteger (sappname,11001) end;        End Reg.            Closekey;    Finally Freeandnil (REG); End;function Tfrmmain.getieversionstr:string;var Reg:tregistry; Registry Access Objectbegin Result: = '; Reg: = tregistry.create; Try Reg.rootkey: = windows.hkey_local_machine;  If Reg.openkeyreadonly (' Software\Microsoft\Internet Explorer ') THEN BEGIN//Here the new version of IE's value location is different so to judge
If Reg.valueexists (' svcversion ') then Result: = reg.readstring (' svcversion ') else if reg.valueexists (' Version ') th En Result: = reg.readstring (' Version '); End Finally Reg.free; End;end;
function TFrmmain.IsWin64:Boolean;
This is someone else to write well, do not remember the original source, see cool Var kernel32handle:thandle; Iswow64process:function (Handle:windows.thandle;var Res:Windows.BOOL): Windows.bool;stdcall; Getnativesysteminfo:procedure (var lpsysteminfo:tsysteminfo); stdcall; Iswow64:bool; Systeminfo:tsysteminfo;const processor_architecture_amd64=9; Processor_architecture_ia64=6;begin kernel32handle:=getmodulehandle (' KERNEL32. DLL '); If Kernel32handle=0 then Kernel32handle:=loadlibrary (' KERNEL32. DLL '); If Kernel32handle<>0 then begin Iswow64process:=getprocaddress (Kernel32handle, ' iswow64process '); Getnativesysteminfo:=getprocaddress (Kernel32handle, ' getnativesysteminfo '); If Assigned (iswow64process) THEN begin Iswow64process (GETCURRENTPROCESS,ISWOW64); Result:=iswow64 and Assigned (Getnativesysteminfo); If Result then begin Getnativesysteminfo (SystemInfo); result:= (SYSTEMINFO.WPROCESSORARCHITECTURE=PROCESSOR_ARCHITECTURE_AMD64) or (systeminfo.wprocessorarchitecture= Processor_architectURE_IA64); End End Else Result:=false; End Else Result:=false;end;

Here's the reference.

Http://www.cnblogs.com/zhwl/p/3147832.html

Reference

{
Value
Description
10001 (0x2711)
Internet Explorer 10. Web page in the IE 10 standard mode display, page! DOCTYPE invalid
10000 (0x02710)
Internet Explorer 10. In IE 10 Standard mode, follow the page! DOCTYPE instructions to display the Web page. Internet Explorer 10 default value.
9999 (0x270f)
Windows Internet Explorer 9. Force IE9 display, ignore! DOCTYPE directive
9000 (0x2328)
Internet Explorer 9. Internet Explorer 9 Default value, in IE9 Standard mode, follow the page! DOCTYPE instructions to display the Web page.
8888 (0X22B8)
Internet Explorer 8, Force IE8 Standard mode display, ignore! DOCTYPE directive
8000 (0X1F40)
Internet Explorer 8 default settings, in IE8 Standard mode, follow the page! DOCTYPE Command Display Web page
7000 (0x1b58)
Use the default values used by the WebBrowser control application in IE7 Standard mode on the Web page! DOCTYPE instructions to display the Web page.
}


{
https://msdn.microsoft.com/en-us/library/ee330730 (v=vs.85). aspx

Internet Feature Controls (B.. C

Updated:july 2012

This article describes feature controls with names, begin with the letters B or C. For links to other feature controls, see Feature Controls.

    • Binary Behavior Security
    • Browser Emulation
    • Child Window Clipping
    • Circular References in Script Management
    • Clipboard Script Control
    • Cross Domain Capture Event
    • Cross Domain redirection
    • Related Topics
Binary Behavior Security

Microsoft Internet Explorer 6 for Windows XP Service Pack 2 (SP2). The feature_behaviors allows Binary behaviors to run more securely. When the feature was enabled, it can be set differently for each security zone by using the URL action flag Urlaction_behav Ior_run. For more information, see About URL Security Zones.

By default, this feature are enabled for Windows Internet Explorer and for Applications hosting the WebBrowser Control. To disable this feature by using the registry, add the name of the your executable file to the following setting.

HKEY_LOCAL_MACHINE (or HKEY_CURRENT_USER)      Software         Microsoft            Internet Explorer               Main                  FeatureControl                     feature_behaviors Contoso.exe = (DWORD) 00000000

The feature is enabled while the value is set to (DWORD) and disabled if the 00000001 value is (DWORD) 00000000 .

Browser Emulation

Windows Internet Explorer 8 and later. The Feature_browser_emulation FEATURE defines the default EMULATION mode for Internet Explorer and supports the following Values.

Value Description
11001 (0x2af9 Internet Explorer 11. Webpages is displayed in IE11 edge mode, regardless of the declared! DOCTYPE directive. Failing to declare a! DOCTYPE directive causes the page to load in Quirks.
11000 (0X2AF8) IE11. Webpages containing standards-based! DOCTYPE directives is displayed in IE11 edge mode. Default value for IE11.
10001 (0x2711) Internet Explorer 10. Webpages is displayed in IE10 standards mode, regardless of the! DOCTYPE directive.
10000 (0x02710) Internet Explorer 10. Webpages containing standards-based! DOCTYPE directives is displayed in IE10 standards mode. Default value for Internet Explorer 10.
9999 (0x270f) Windows Internet Explorer 9. Webpages is displayed in IE9 standards mode, regardless of the declared! DOCTYPE directive. Failing to declare a! DOCTYPE directive causes the page to load in Quirks.
9000 (0x2328) Internet Explorer 9. Webpages containing standards-based! DOCTYPE directives is displayed in IE9 mode. Default value for Internet Explorer 9.  Important In Internet Explorer, webpages containing standards-based! DOCTYPE directives is displayed in IE10 standards mode.
8888 (0X22B8) Webpages is displayed in IE8 standards mode, regardless of the declared! DOCTYPE directive. Failing to declare a! DOCTYPE directive causes the page to load in Quirks.
8000 (0X1F40) Webpages containing standards-based! DOCTYPE directives is displayed in IE8 mode. Default value for Internet Explorer 8Important in Internet Explorer, webpages containing standards-based! DOCTYPE directives is displayed in IE10 standards mode.
7000 (0x1b58) Webpages containing standards-based! DOCTYPE directives is displayed in IE7 standards mode. Default value for Applications hosting the WebBrowser Control.

For more information, see Defining Document compatibility.

To control the value of the feature by using the registry, add the name of your executable file to the following setting and set the value to match the desired setting.

HKEY_LOCAL_MACHINE (or HKEY_CURRENT_USER)      Software         Microsoft            Internet Explorer               Main                  FeatureControl                     feature_browser_emulation Contoso.exe = (DWORD) 00009000
Child Window Clipping

Internet Explorer 9. Internet Explorer 9 Optimized the performance of window-drawing routines that involve clipping regions associated with CHI LD windows. This helped improve the performance of certain window drawing operations. However, certain applications hosting the WebBrowser Control rely on the previous behavior and does not function correctly W Hen these optimizations is enabled. The feature_enable_clipchildren_optimization FEATURE can disable these optimizations.

By default, this feature are enabled for Internet Explorer and for Applications hosting the WebBrowser Control. To disable this feature by using the registry, add the name of the your executable file to the following setting.

HKEY_LOCAL_MACHINE (or HKEY_CURRENT_USER)      Software         Microsoft            Internet Explorer               Main                  FeatureControl                     feature_enable_clipchildren_optimization Contoso.exe = (DWORD) 00000000

The feature is enabled while the value is set to (DWORD) and disabled if the 00000001 value is (DWORD) 00000000 .

Circular References in Script Management

Internet Explorer 8 and later. By default, Internet Explorer reduces memory leaks caused by circular references between Internet Explorer and the Microso FT JScript engine, especially in scenarios where a webpage defines an expando and the page is refreshed. If a legacy application no longer functions with these changes, the Feature_manage_script_circular_refs FEATURE can disabl e these improvements.

By default, this feature are enabled for Internet Explorer and for Applications hosting the WebBrowser Control. To disable this feature by using the registry, add the name of the your executable file to the following setting.

HKEY_LOCAL_MACHINE (or HKEY_CURRENT_USER)      Software         Microsoft            Internet Explorer               Main                  FeatureControl                     Feature_manage_script_circular_refs Contoso.exe = (DWORD) 00000000

The feature is enabled while the value is set to (DWORD) and disabled if the 00000001 value is (DWORD) 00000000 .

NoteBecause This feature improves the stability of Internet Explorer, disabling this feature is strongly discouraged. Clipboard Script Control

When enabled, the Feature_enable_script_paste_urlaction_if_prompt FEATURE allows scripts control over the Clipboard, even When the Urlaction_script_paste URL, action is set to "Prompt." This allows applications hosting the WebBrowser Control-to-opt out of a specific security check that is may unnecessary fo R the content displayed by the application. If the content is fully trusted and cannot are modified by any third-party, it may safe to enable this feature. However, such a design decision should include a full security assessment. For more information, see Threat Modeling.

By default, this feature are disabled for Internet Explorer and enabled for applications hosting the WebBrowser Control. To enable this feature by using the registry, add the name of your executable file to the following setting.

HKEY_LOCAL_MACHINE (or HKEY_CURRENT_USER)      Software         Microsoft            Internet Explorer               Main                  FeatureControl                     feature_enable_script_paste_urlaction_if_prompt Contoso.exe = (DWORD) 00000001

The feature is enabled while the value is set to (DWORD) and disabled if the 00000001 value is (DWORD) 00000000 .

Cross Domain Capture Event

The Feature_block_setcapture_xdomain FEATURE prevents capture events from being propagated to elements in webpages hosted On domains different than the one hosting the page containing the element that triggered the capture event.

By default, this feature are enabled for Internet Explorer 8 and for applications hosting the WebBrowser Control. To disable this feature by using the registry, add the name of the your executable file to the following setting.

HKEY_LOCAL_MACHINE (or HKEY_CURRENT_USER)      Software         Microsoft            Internet Explorer               Main                  FeatureControl                     Feature_block_setcapture_xdomain Contoso.exe = (DWORD) 00000000

The feature is enabled while the value is set to (DWORD) and disabled if the 00000001 value is (DWORD) 00000000 .

Cross Domain redirection

When enabled, the Feature_cross domain_redirect_mitigation FEATURE applies cross-domain security to support files loaded B Y a webpage, including images, JavaScript libraries, cascading Style Sheets (CSS) files, Microsoft ActiveX controls, and O ther file-based resources.

NoteFor security reasons, the This feature should isn't be changed.

By default, this feature are enabled for Internet Explorer 8 and for applications hosting the WebBrowser Control. To disable this feature by using the registry, add the name of the your executable to the following setting.

HKEY_LOCAL_MACHINE (or HKEY_CURRENT_USER)      Software         Microsoft            Internet Explorer               Main                  FeatureControl                     feature_cross_domain_redirect_mitigation Contoso.exe = (DWORD) 00000000

The feature is enabled while the value is set to (DWORD) and disabled if the 00000001 value is (DWORD) 00000000 .


}

Delphi Force WebBrowser control to display Web pages with a specified version

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.