How to disable "alert" javascript in HTMLViewer?

How to disable “alert” javascript in HTMLViewer?
I need to disable all popups in HTMLViewer.
I’m loading web pages that don’t have access to modify html source code. but I have to disable the popups that the HTML code generates.

JavaScript Alert is the equivalent of Msgbox.

But you seem to be referring to something else. What you call popups can be created in so many ways. It can be difficult to stop these popups, although in general they are displayed by Javascript timers, and those can be turned off.

It would require to see the source code to have an idea about how to proceed.

Here is what you put in the DocumentComplete event, to suppress all scripts, effectively preventing those stupid boxes that want you to subscribe, or buy something:

dim js as string js = js + "var str = document; var res = str.replace(/<script>/gi, '<!---'); document = res; " js = js + "var str = document; var res = str.replace(/<script>/gi, '--->'); document = res;" HTMLViewer1.ExecuteJavaScript(js)

Note that suppressing JavaScript could prevent some pages to work as expected, and impair their ability to display content. Also, if the boxes are displayed with another type of program, it won’t work.