Re: Removing alerts from WebBrowser control

Tech Tip: Click here to run a free scan for Windows Errors and optimize PC performance



Sin Jeong-hun,

How are you loading the HTML? Are you dynamically generating it or are
you loading it from the web/a file.

If you are loading it from a file, I would modify the contents of the
file before you load it.

If you are loading it from the web, then I would download the content
into a MemoryStream first and then modify the contents of the file, then
passing it to the DocumentStream property of the WebBrowser control.

Hope this helps.


--
- Nicholas Paldino [.NET/C# MVP]
- mvp@xxxxxxxxxxxxxxxxxxxxxxxxxxx

"Sin Jeong-hun" <typingcat@xxxxxxxxx> wrote in message
news:1174067310.168528.164490@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
Is it possible to modify the HTML or the script of a WebBrowser
control in DocumentCompleted event? I tried to modify it but that
caused DocumentCompleted again so the program fell in an endless loop.
The reason I'm trying to do so is to remove some specific scripts like
"alert()" because it locks up the WebBrowser control. When there's an
alert box is open, calling Navigate causes an exception. I need other
scripts to be executed so I cannot turn the entier Javascript off.

So in short, how can I modify the html in DocumentComplete event
before alert() is executed?



.



Relevant Pages

  • Re: Parse HTML DOM document in console application
    ... I have made a simple console app that demonstrates the loading of HTML from ... > but was unable to make the solution by Charles Law work on my m/c (I have ...
    (microsoft.public.dotnet.languages.vb)
  • Re: background flicker
    ... The HTML is stored locally on the disk... ... the background drawn WHILE the flash content is being loaded (therefore, ... the framework is busy loading the HTML before OnEraseBkgnd gets a chance to ... But then, if this is the case, I shouldn't see the window ...
    (microsoft.public.vc.mfc)
  • Re: JEditorPane, How to get HTML
    ... Loading the page with getPage works asyncrounously so reading the text from the EditorPane may not be valid if the page is not completed loading. ... My problem is I want to save the HTML from the page displayed into a string. ... String tempString = new String; ...
    (comp.lang.java)
  • Ie6 password input problem
    ... This is about IE6 crashing after loading an html ... page with a password input field with a value=" " option containing ...
    (Vuln-Dev)
  • Re: ActiveSync by IRDA in WinCE .NET ?
    ... Maybe you could try to modify the order of IrCOMM ... to let it loading after SIR NDIS driver is ready. ...
    (microsoft.public.windowsce.platbuilder)