【问题标题】:WebView InvokeScript HRESULT 0x80020101WebView InvokeScript HRESULT 0x80020101
【发布时间】:2012-05-05 22:14:17
【问题描述】:

我正在尝试调用 WebView 中的函数。我需要调用的一些目标函数是:

play: function()
{
    if (this.value < this.p.max)
    {
        this.inc();
        this.timer = new it_timer({ object: this, method: "play", timeout: 200 });
    }
    else
        this.stop();
},
stop: function()
{
    if (this.timer)
        this.timer.stop();
    this.playing = false;
    this.playbutton.style.backgroundPosition = "0 0";
}

我从打电话开始

webView.InvokeScript("play", new string[0]);

但这不起作用,HRESULT: 0x80020101。我在这个主题上找到了这个http://support.microsoft.com/kb/247784,但它对我一点帮助都没有。

然后我尝试做我在多个网站上找到的示例:

webView.InvokeScript("eval", new string[] { "document.documentElement.outerHTML;");

webView.InvokeScript("alert", new string[] {"message"});

但是这两个都不起作用,给出了相同的 HRESULT 代码。 WebView 可以正常呈现,并且 javascript 在页面上运行良好。

在确定问题/寻找解决方案方面提供任何帮助。

编辑:似乎“警报”并且在类中声明的所有方法都不起作用。在早期的 .NET 版本中似乎有一个 InvokeMethod(..),有没有 WinRT 的替代品?

【问题讨论】:

  • 我也想知道这一点,如果有人能解决这个问题或戳微软的某个人来回答这个问题,我将非常高兴。

标签: c# webview windows-runtime invokescript


【解决方案1】:

当您在 javascript 中出现语法错误时,就会出现该错误。

【讨论】:

  • 谢谢,很抱歉这么长时间没有将其标记为答案。可悲的是,对我的情况并没有真正的帮助,因为我无法控制 javascript。
  • 谢谢。这对我有帮助。需要明确的是,当存在运行时错误时也会发生这种情况(在我的情况下,使用未声明的变量)。
猜你喜欢
  • 2021-09-13
  • 1970-01-01
  • 1970-01-01
  • 2016-04-12
  • 2016-11-04
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2012-10-17
相关资源
最近更新 更多