Javascript error with Webbrowser

Asked

Viewed 666 times

1

I am creating an application with Webbrowser component in C# but when running the following code it returns me Javascript error and does not run my other application that was developed in Adobe Flex:

private void chamaPagina(string tipo)
{
    string url = "";
    string pac = "http://localhost/accelerated_pac_base.pac";

    if (tipo == "frete")
    {
        url = "http://localhost/frete.html#";
    }
    else
    {
        url = "http://localhost/posto.html#";
    }

    //Método externo para ler arquivo pac e configurar proxy
    WebRequest requestNavegador = (HttpWebRequest)WebRequest.Create(url);

    string dadosProxy = Proxy.GetProxyForUrlUsingPac(url, pac);

    if (dadosProxy != null)
    {
        requestNavegador.Proxy = new WebProxy(dadosProxy);
    }

    HttpWebResponse response = (HttpWebResponse)requestNavegador.GetResponse();
    Stream receiveStream = response.GetResponseStream();

    webBrowser1.DocumentStream = receiveStream;
}

But if I add webBrowser1.ScriptErrorsSuppressed = true; it did not display the error messages and still not running my application in Adobe FLEX.

inserir a descrição da imagem aqui

  • Running the program brings up some error message on the console?

  • Does not return any error, appears only the script error message, if I use webBrowser1.Navigate('http://localhost/frete.html#') the problem does not occur, but I need it to be applied proxy through the file . Pac

  • "No error returns me, only the script error message appears" - which is the exact text of the message?

  • http://i.stack.Imgur.com/kUYfM.png

1 answer

0


The error occurs because the browser engine that it uses is Ie and some Java script functions do not run on Ie, what happened is that you just did not let the error appear but it is there, I suggest using a Try so the error happens but your application continues.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.