Skip to content Skip to sidebar Skip to footer

Webbrowser.invokescript() Throws Error: 80020006

I am developing a Windows Phone 8 App and i am new to Windows Phone 8. I am using WebBrowser Control and try to load the html page having javascript. On button_Click event i am ca

Solution 1:

Scripts are not getting executed when you use NavigateToString under WP8. The following test proves this, the body background color doesn't turn red.

<scripttype="text/javascript">document.body.style.backgroundColor = "red";

    window.initialize = function() {
        document.body.style.backgroundColor = "blue";

        var helloText = document.getElementById("Hello");
        helloText.textContent = "Initialized";

        return ("Initialize");
    }
</script>

One possible solution is to create a temporary file in the isolated storage, as described here.

Another option is to navigate to a blank page with Navigate("about:blank"), handle WebBrowser.LoadCompleted event, then inject the desired HTML and scripts, as described here.

Post a Comment for "Webbrowser.invokescript() Throws Error: 80020006"