Fazer uma PerguntaFazer uma Pergunta
 

RespondidoWebBrowser and javascript alert

Respostas

  • sexta-feira, 3 de julho de 2009 5:12antonpious Medalhas de usuárioMedalhas de usuárioMedalhas de usuárioMedalhas de usuárioMedalhas de usuário
     Respondido
    What you are getting is a Javascript Error shown in an Alert Box.

    You can't turn of Alert Box Completely as this is a feature of the Browser and would require the target web page not to use an Alert Javascript method call, what you can turn off is Errors in Javascript from throwing an alert.

    If you want read made web browser instead of using the

    System.Windows.Controls.WebBrowser you need to use the System.Windows.Forms.WebBrowser present in System.Windows.Forms.dll and set the browserInstance.ScriptErrorsSuppressed = true/false;

    This is suppress or show any errors.

    If you want this for WPF browser you need to do this at the web page level

    window.onerror = HandleGlobalError;

    function HandleGlobalError(errorMsg,errorUrl,errorLine)
    {
     write code to handle this error
    }

    This would prevent the javascript error alert from shown to the User.

    Happy Programming
    Anton


    • Marcado como RespostaORover sábado, 4 de julho de 2009 22:28
    •  

Todas as Respostas

  • sexta-feira, 3 de julho de 2009 5:12antonpious Medalhas de usuárioMedalhas de usuárioMedalhas de usuárioMedalhas de usuárioMedalhas de usuário
     Respondido
    What you are getting is a Javascript Error shown in an Alert Box.

    You can't turn of Alert Box Completely as this is a feature of the Browser and would require the target web page not to use an Alert Javascript method call, what you can turn off is Errors in Javascript from throwing an alert.

    If you want read made web browser instead of using the

    System.Windows.Controls.WebBrowser you need to use the System.Windows.Forms.WebBrowser present in System.Windows.Forms.dll and set the browserInstance.ScriptErrorsSuppressed = true/false;

    This is suppress or show any errors.

    If you want this for WPF browser you need to do this at the web page level

    window.onerror = HandleGlobalError;

    function HandleGlobalError(errorMsg,errorUrl,errorLine)
    {
     write code to handle this error
    }

    This would prevent the javascript error alert from shown to the User.

    Happy Programming
    Anton


    • Marcado como RespostaORover sábado, 4 de julho de 2009 22:28
    •