Disable scripts in WebBrowser Control

I have an HTML page that I want to display in a WebBrowser control, but I want to keep its layout. It can be any loaded page, I want it to be static (not interactive), which means there is no javascript or Flash, but the user can still use the scroll bars to move around the page.

I am going to remove all tags except the main tags (img, table, etc.), because I am not familiar with different types of scripts and plugins, I just want to save the layout. What is the best way to do this?

+3
source share
2 answers

Maybe the control WebBrowserhas properties for disabling scripts, but if not, you can use the AntiXSS library to disinfect the HTML of all executable JavaScript.

Look at here:

http://wpl.codeplex.com/

+2
source

A very simple way: disable the "display images" setting in IE (tab "Tools → Internet settings → advanced settings"). Web browser control uses the same settings! (unless you cancel it on your code).

-1
source

Source: https://habr.com/ru/post/1760225/


All Articles