我目前正在使用 ie 作为 wxWidgets 上的事件 x com 事物,并且想知道是否有任何简单的方法来更改始终有效的用户代理。
Atm 我正在更改标题,但这仅在我手动加载链接(即调用 setUrl)时有效
最佳答案
据我所知,“始终有效”的唯一方法是 changing the user-agent string in the registry 。当然,这会影响该计算机上运行的每个 Web 浏览器实例。
您还可以尝试在 DISPID_AMBIENT_USERAGENT
上进行 Google 搜索。来自 this Microsoft page :
MSHTML will also ask for a new user agent via
DISPID_AMBIENT_USERAGENT
when navigating to clicked hyperlinks. This ambient property can be overridden, but it is not used when programmatically calling the Navigate method; it will also not cause the userAgent property of the DOM's navigator object or clientInformation behavior to be altered - this property will always reflect Internet Explorer's own UserAgent string.
我不熟悉 MSHTML 组件,因此我不确定这是否有帮助。
我希望这至少能为您提供一个起点。 :-)
关于c++ - 即用户代理wxWidgets,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/233911/