开发者

How can you block the image to appear on WebBrowser Control?

开发者 https://www.devze.com 2022-12-22 12:14 出处:网络
I have created a simple web browser 开发者_高级运维using c# and I want to block the images to appear on WebBrowser control. Can you please show me a sample code for this? Thanks in advance.You can rem

I have created a simple web browser 开发者_高级运维using c# and I want to block the images to appear on WebBrowser control. Can you please show me a sample code for this? Thanks in advance.


You can remove image-tags from the source htm like this:

string content = new WebClient().DownloadString(@"http://www.google.com/");
string contentWithoutImages = Regex.Replace(content, @"<img(.|\n)*?>", string.Empty);
webBrowser1.DocumentText = contentWithoutImages;
0

精彩评论

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