本文介绍了更改IE COM对象UserAgent的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

关于此线程,我需要以编程方式(从C#代码)更改IE11实例的UserAgent.我使用自动化(COM Internet Explorer对象):

SHDocVw.InternetExplorer IE = new SHDocVw.InternetExplorer()

由于IE实例不在进程内运行,因此使用urlmon的"UrlMkSetSessionOption"不会更改iexplore.exe使用的UA.另一方面,EricLawrence的附加组件不允许以编程方式设置新的UA. /p>

有解决方案吗?

解决方案

Eric非常有礼貌,他向我展示了加载项使用名为"OverrideUA"的注册表值来进行持久配置-这允许通过外部代码进行程序设置. Thead可能已关闭

Regarding this thread,I need to change the UserAgent programatically (from a C# code) of a IE11 instance. I use automation (COM Internet Explorer Object):

SHDocVw.InternetExplorer IE = new SHDocVw.InternetExplorer()

As IE instances do not run in-process, using urlmon´s "UrlMkSetSessionOption" does not change UA used by iexplore.exe On the other side, add-on of EricLawrence does not allow to set programatically the new UA.

Any solution?

解决方案

Eric has been very polite and he has showed me that add-on uses a registry value called "OverrideUA" in order to have a persistent configuration- That allows a programatic setting from an external code. Thead may be closed

这篇关于更改IE COM对象UserAgent的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-13 13:40