开发者

Disable scripts in WebBrowser Control

开发者 https://www.devze.com 2023-01-11 20:26 出处:网络
I have a HTML page that I want 开发者_如何学Goto display in a WebBrowser control, I only want to preserve its layout. It can be any page downloaded, I want it to be static (non-interactive), meaning n

I have a HTML page that I want 开发者_如何学Goto display in a WebBrowser control, I only want to preserve its layout. It can be any page downloaded, I want it to be static (non-interactive), meaning no javascript or Flash, but the user can still use scrollbars to move around the page.

I am thinking of stripping out all tags except for basic tags (img, table, etc) because I'm not familiar with different types of scripts and plugins, I only want to preserve layout. What is the best way to do this?


It may be that the WebBrowser control has properties to disable scripts, but if not, you can use the AntiXSS library to sanitize the HTML of all executable JavaScript.

Check it out here:

http://wpl.codeplex.com/

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号