我需要Windows窗体应用程序中的Webbrowser控件使用最新版本的Internet Explorer呈现页面,或至less安装在我的机器上的最新版本 – 即IE 11。
几个星期前,在我开始这个项目的工作之前,我遇到了一个名为DevDocs.io的网站,并在IE 11中运行。 但是,即使在应用registry黑客之后,我无法在Webbrowser控件中查看DevDocs.io,因为显然我正在使用“不支持”的浏览器。 然后接着说我需要使用Firefox,Chrome或IE 10+。 我以为我使用IE 10 +,因为我已经将DWORD添加到registry中。
我遇到了很多网站,只是不显示或行为正常,因为Webbrowser控件仍然不是呈现在IE11,或10,或9 …
有两件事我想知道:
closuresWindows资源pipe理器的特定实例
如何检查.NET框架是否安装
禁用单个应用程序的凭证pipe理器
单声道WCF InstanceContextMode不工作
是否有一个方法或类暴露Webbrowser控件使用的渲染引擎?
DWORDregistry为什么不能正常工作,我怎样才能使它工作?
要清楚的是,我已经到了registry,并抬起头: HKEY LOCAL MACHINE > SOFTWARE > MICROSOFT > INTERNET EXPLORER > MAIN > FEATURE CONTROL > FEATURE_broWSER_EMULATION并添加了一个DWORD值myApp.exe和11000 。
11000是得到它使用IE11呈现,按照http://msdn.microsoft.com/en-us/library/ee330730%28VS.85%29.aspx#browser_emulation 。
如何从C#桌面应用程序以全屏模式打开默认浏览器?
将sql数据库附加到ComboBox.ItemSource(WPF)
阻止用户停止进程
selectListView的特定列并将其打印在C#.net的新消息框中
免费的Windows安装程序
您需要在主(64位)节点和32位节点HKEY_LOCAL_MACHInesOFTWAREWow6432NodeMicrosoftInternet ExplorerMainFeatureControl下添加注册表项
您应该访问http://webdbg.com/ua.aspx来验证文档模式和UA字符串。
这里我通常使用和为我工作的方法(32位和64位应用程序):
[STAThread] static void Main() { if (!mutex.WaitOne(TimeSpan.FromSeconds(2),false)) { //another application instance is running return; } try { Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(false); var targetApplication = Process.GetCurrentProcess().ProcessName + ".exe"; int ie_emulation = 10000; try { string tmp = Properties.Settings.Default.ie_emulation; ie_emulation = int.Parse(tmp); } catch { } SetIEVersioneKeyforWebbrowserControl(targetApplication,ie_emulation); m_webLoader = new FormMain(); Application.Run(m_webLoader); } finally { mutex.ReleaseMutex(); } } private static void SetIEVersioneKeyforWebbrowserControl(string appName,int ieval) { RegistryKey Regkey = null; try { Regkey = Microsoft.Win32.Registry.LocalMachine.OpenSubKey(@"SOFTWAREMicrosoftInternet ExplorerMainFeatureControlFEATURE_broWSER_EMULATION",true); //If the path is not correct or //If user't have priviledges to access registry if (Regkey == null) { YukLoggerObj.logWarnMsg("Application FEATURE_broWSER_EMULATION Failed - Registry key Not found"); return; } string FindAppkey = Convert.ToString(Regkey.GetValue(appName)); //Check if key is already present if (FindAppkey == "" + ieval) { YukLoggerObj.logInfoMsg("Application FEATURE_broWSER_EMULATION already set to " + ieval); Regkey.Close(); return; } //If key is not present or different from desired,add/modify the key,key value Regkey.SetValue(appName,unchecked((int)ieval),RegistryValueKind.DWord); //check for the key after adding FindAppkey = Convert.ToString(Regkey.GetValue(appName)); if (FindAppkey == "" + ieval) YukLoggerObj.logInfoMsg("Application FEATURE_broWSER_EMULATION changed to " + ieval + "; changes will be visible at application restart"); else YukLoggerObj.logWarnMsg("Application FEATURE_broWSER_EMULATION setting Failed; current value is " + ieval); } catch (Exception ex) { YukLoggerObj.logWarnMsg("Application FEATURE_broWSER_EMULATION setting Failed; " + ex.Message); } finally { //Close the Registry if (Regkey != null) Regkey.Close(); } }
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 [email protected] 举报,一经查实,本站将立刻删除。