WinRT WebView.InvokeScript–Could not complete the operation due to error 8080000c

Posted by Blake on 4/30/2012
)

This error may occur when interacting with JavaScript and IE (version 10 beta in my case). My case came up with using the WebView’s InvokeScript method to get around some limitations in what the WebView exposes (in relation to what the old WinForms WebBrowser used to expose).

In my case, this error comes about because you have bad JavaScript and/or a JavaScript error is being thrown. To test, I created a snippet of JavaScript that set the value on an HTML element on the page. It worked fine. If I navigate to a page that didn’t have that element and tried to execute it, I would get the above error. Here was my test code:

    Dim buf As String = wv1.InvokeScript("eval", New String() {"document.getElementById(""inputx"").value = '500';"})