gpt4 book ai didi

javascript - 如何修复使用 IWebBrowser2 的应用程序中的 javascript 错误?

转载 作者:可可西里 更新时间:2023-11-01 10:27:09 25 4
gpt4 key购买 nike

我有一个 C++ 应用程序,它使用 IWebBrowser2 接口(interface)呈现一些在线 html 页面。问题是,当访问某个链接时,我收到一个 javascript 错误,尽管如果我使用 Internet Explorer 访问同一页面,该页面加载时没有错误。我的应用程序收到的错误是“对象不支持此操作”

我能够通过使用 put_Silent() 方法并将其设置为 VARIANT_TRUE 来隐藏错误,但这不是解决方案,因为显示的内容不正确。

我知道 IWebBrowser2 正在使用 Internet Explorer 引擎加载页面,所以我想有一种方法可以解决这个问题,因为页面在 IE 中加载正常。

最佳答案

您可能必须实现 IDocHostShowUI::ShowMessage .

When your application hosts the browser control, you can replace the Windows Internet Explorer message box caption (which is used for Microsoft JScript alerts among other things) with a custom caption

我想你会想要返回 S_FALSE。

S_FALSE Host did not display its UI. MSHTML displays its message box.

关于javascript - 如何修复使用 IWebBrowser2 的应用程序中的 javascript 错误?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/12642479/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com