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_EMULATION';
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 object
begin
Result := '';
Reg := TRegistry.Create;
try
Reg.RootKey := Windows.HKEY_LOCAL_MACHINE;
if Reg.OpenKeyReadOnly('Software\Microsoft\Internet Explorer') then
begin
//这儿新版本IE的取值位置不同所以要判断
if Reg.ValueExists('svcVersion') then
Result := Reg.ReadString('svcVersion')
else
if Reg.ValueExists('Version') then
Result := Reg.ReadString('Version');
end;
finally
Reg.Free;
end;
end;
function TFrmmain.IsWin64:Boolean;
//这个是别人写好的,不记得原出处了,见凉
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;

  参考了这儿

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

参考

{

说明
10001 (0x2711)
Internet Explorer 10。网页以IE 10的标准模式展现,页面!DOCTYPE无效
10000 (0x02710)
Internet Explorer 10。在IE 10标准模式中按照网页上!DOCTYPE指令来显示网页。Internet Explorer 10 默认值。
9999 (0x270F)
Windows Internet Explorer 9. 强制IE9显示,忽略!DOCTYPE指令
9000 (0x2328)
Internet Explorer 9. Internet Explorer 9默认值,在IE9标准模式中按照网页上!DOCTYPE指令来显示网页。
8888 (0x22B8)
Internet Explorer 8,强制IE8标准模式显示,忽略!DOCTYPE指令
8000 (0x1F40)
Internet Explorer 8默认设置,在IE8标准模式中按照网页上!DOCTYPE指令展示网页
7000 (0x1B58)
使用WebBrowser Control控件的应用程序所使用的默认值,在IE7标准模式中按照网页上!DOCTYPE指令来展示网页。
}

{
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 that begin with the letters B or C. For links to other feature controls, see Feature Controls.

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 is enabled, it can be set differently for each security zone by using the URL action flag URLACTION_BEHAVIOR_RUN. For more information, see About URL Security Zones.

By default, this feature is enabled for Windows Internet Explorer and for applications hosting the WebBrowser Control. To disable 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_BEHAVIORS
                     contoso.exe = (DWORD) 00000000

The feature is enabled when the value is set to (DWORD) 00000001 and disabled when the 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 are 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 are displayed in IE11 edge mode. Default value for IE11.
10001 (0x2711) Internet Explorer 10. Webpages are displayed in IE10 Standards mode, regardless of the !DOCTYPE directive.
10000 (0x02710) Internet Explorer 10. Webpages containing standards-based !DOCTYPE directives are displayed in IE10 Standards mode. Default value for Internet Explorer 10.
9999 (0x270F) Windows Internet Explorer 9. Webpages are 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 are displayed in IE9 mode. Default value for Internet Explorer 9.

Important  In Internet Explorer 10, Webpages containing standards-based !DOCTYPE directives are displayed in IE10 Standards mode.
 
8888 (0x22B8) Webpages are 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 are displayed in IE8 mode. Default value for Internet Explorer 8

Important  In Internet Explorer 10, Webpages containing standards-based !DOCTYPE directives are displayed in IE10 Standards mode.
 
7000 (0x1B58) Webpages containing standards-based !DOCTYPE directives are 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 this 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 child windows. This helped improve the performance of certain window drawing operations. However, certain applications hosting the WebBrowser Control rely on the previous behavior and do not function correctly when these optimizations are enabled. The FEATURE_ENABLE_CLIPCHILDREN_OPTIMIZATION feature can disable these optimizations.

By default, this feature is enabled for Internet Explorer and for applications hosting the WebBrowser Control. To disable 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_CLIPCHILDREN_OPTIMIZATION
                     contoso.exe = (DWORD) 00000000

The feature is enabled when the value is set to (DWORD) 00000001 and disabled when the 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 Microsoft 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 disable these improvements.

By default, this feature is enabled for Internet Explorer and for applications hosting the WebBrowser Control. To disable 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_MANAGE_SCRIPT_CIRCULAR_REFS
                     contoso.exe = (DWORD) 00000000

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

Note  Because 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 may be unnecessary for the content displayed by the application. If the content is fully trusted and cannot be modified by any third-party, it may be 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 is 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 when the value is set to (DWORD) 00000001 and disabled when the 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 is enabled for Internet Explorer 8 and for applications hosting the WebBrowser Control. To disable 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_BLOCK_SETCAPTURE_XDOMAIN
                     contoso.exe = (DWORD) 00000000

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

Cross Domain Redirection

When enabled, the FEATURE_CROSS DOMAIN_REDIRECT_MITIGATION feature applies cross-domain security to support files loaded by a webpage, including images, JavaScript libraries, Cascading Style Sheets (CSS) files, Microsoft ActiveX controls, and other file-based resources.

Note  For security reasons, this feature should not be changed.
 

By default, this feature is enabled for Internet Explorer 8 and for applications hosting the WebBrowser Control. To disable this feature by using the registry, add the name of 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 when the value is set to (DWORD) 00000001 and disabled when the value is (DWORD) 00000000.

}

delphi强制WebBrowser控件使用指定版本显示网页的更多相关文章

  1. 强制IE浏览器或WebBrowser控件使用指定版本显示网页

    自从装了IE10之后,就发现好些个网站显示都不是那么的正常,网站上有些功能竟然还会出现一些意想不到的BUG——本来就是针对IE开发的,现在IE下竟然用不起来了,让用户情何以堪?但是就为少量用户使用的系 ...

  2. 强制IE浏览器或WebBrowser控件使用指定版本显示网页2

    一.问题的提出 偶然发现,Winform里的WebBrowser和IE实际安装的版本似乎并不同步,很有趣! 下面有张图,里面一个窗口是用IE9打开某网站,另一个窗口是用Winform+WebBrows ...

  3. Delphi中WebBrowser控件打开部分网站报"Invalid floating point operation”解决

    Delphi中WebBrowser控件打开部分网站报"Invalid floating point operation”解决 EmbeddedWBWebBrowserDelphi  最近用E ...

  4. VC++使用WebBrowser控件,强制给控件指定版本显示网页

    转载:http://www.cnblogs.com/1175429393wljblog/p/5398928.html 最近为了抓取淘宝的成交数据,用C#的WebBrowser控件开发了一个简单的程序. ...

  5. [JavaScript]WebBrowser控件下IE版本的检测

    转载请注明原文地址:https://www.cnblogs.com/litou/p/10772272.htm 在客户端检查用户使用的浏览器类型和版本,都是根据navigator.userAgent属性 ...

  6. 在.net中修改Webbrowser控件的IE版本

    根据32位.64位系统来分别修改对应的注册表路径的键值对,不需要重启程序. /// <summary> /// 修改Webbrowser控件模拟的IE版本 /// </summary ...

  7. <总结>delphi WebBrowser控件的使用中出现的bug

    Delphi WebBrowser控件的使用中出现的bug:  1.WebBrowser.Visible=false:Visible属性不能使WebBrowser控件不可见,暂时用 WebBrowse ...

  8. C# Winform WebBrowser控件

    C# WinForm WebBrowser 1.主要用途:使用户可以在窗体中导航网页. 2.注意:WebBrowser 控件会占用大量资源.使用完该控件后一定要调用 Dispose 方法,以便确保及时 ...

  9. Webbrowser控件判断网页加载完毕的简单方法 (转)

    摘自:http://blog.csdn.net/cometnet/article/details/5261192 一般情况下,当ReadyState属性变成READYSTATE_COMPLETE时,W ...

随机推荐

  1. centos iptables

    1.查看本机关于IPTABLES的设置情况iptables -L -niptables --listmore /etc/sysconfig/iptablesservice iptables statu ...

  2. iOS常见算法(二分法 冒泡 选择 快排)

    二分法: 平均时间复杂度:O(log2n) int halfFuntion(int a[], int length, int number)  { int start = 0; int end = l ...

  3. 怎样使java程序减少内存占用(转载)

    本文收集网上关于减少java程序占用的一些小知识点 (1)别用new Boolean(). 在很多场景中Boolean类型是必须的,比如JDBC中boolean类型的set与get都是通过Boolea ...

  4. Jmeter学习(三十三)调试工具Debug Sampler

    一.Debug Sampler介绍: 使用Jmeter开发脚本时,难免需要调试,这时可以使用Jmeter的Debug Sampler,它有三个选项:JMeter properties,JMeter v ...

  5. ionic build android error when download gradle

    这里我遇到一个问题,当用  ionic build android 的时候,无数次build,无数次失败的时候,我真想骂一句,NND的GNF,我又想起武大的臭鸡蛋,是的,该丢,发明这种东西的人,难道不 ...

  6. 关于Java中基本类型的长度相关基础知识

    1.  用HeapByteBuffer放int占几个byte? 占4个.而且不论你是放1还是-1还是0xffff. 因为int的长度是4个byte,HeapByteBuffer的存储又是byte数组. ...

  7. sh脚本异常:/bin/sh^M:bad interpreter: No such file or directory

    在Linux中执行.sh脚本,异常/bin/sh^M: bad interpreter: No such file or directory. 分析:这是不同系统编码格式引起的:在windows系统中 ...

  8. 用Netty开发中间件:高并发性能优化

    用Netty开发中间件:高并发性能优化 最近在写一个后台中间件的原型,主要是做消息的分发和透传.因为要用Java实现,所以网络通信框架的第一选择当然就是Netty了,使用的是Netty 4版本.Net ...

  9. noi 1.5 43:质因数分解

    描述 已知正整数 n 是两个不同的质数的乘积,试求出较大的那个质数. 输入 输入只有一行,包含一个正整数 n.对于60%的数据,6 ≤ n ≤ 1000.对于100%的数据,6 ≤ n ≤ 2*10^ ...

  10. Leetcode: LFU Cache && Summary of various Sets: HashSet, TreeSet, LinkedHashSet

    Design and implement a data structure for Least Frequently Used (LFU) cache. It should support the f ...