如何充当 Internet Explorer

How to Act as Internet Explorer

我在 windows 表单应用程序中使用 cefsharp。不知何故,有些网站只需要 运行 在 Internet Explorer 上。我们如何设置 cefsharp (chromium) 像 Internet Explorer 一样?

我更改了请求 headers 以将 user-agent 设置为 "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.0; Windows NT 7.0; InfoPath.3; .NET CLR 3.1.40767; Trident/6.0; en-IN)",但这并没有解决我的问题。该站点仍然获取浏览器不是 IE。

能否请您提供解决方案?

感谢您的进一步帮助

我找到了伪造站点的解决方案,例如将缺失的 property/funcs 添加到 frameloadstart 事件中的文档对象,就像这样。

        private void Browser_FrameLoadStart(object sender, FrameLoadStartEventArgs e)
    {
        browser.EvaluateScriptAsync(@"if(!document.all) { document.all = {};}  if(!document.compatMode) { document.compatMode = 'BackCompat'} if(!document.getElementsByTagName){ document.getElementsByTagName = function(){}; } ");
    }