如何在Internet Explorer或.NET webbrowser控件中阻止iframe(How to blocking iframes in internet explorer or .NET

编程入门 行业动态 更新时间:2024-10-25 20:26:46
如何在Internet Explorer或.NET webbrowser控件中阻止iframe(How to blocking iframes in internet explorer or .NET webbrowser control)

我需要一些帮助来阻止在Internet Explorer或.NET浏览器控制中的iframe。 我尝试过安全性偏好,但这种方式无效。 XP和IE8,以及.NET Framework 4.0

I need some help to blocking iframes in internet explorer or .NET webbrowser control. I tried security preferences, that doesn't worked. XP and IE8, with .NET Framework 4.0

最满意答案

在WebBrowser的DocumentCompleted事件中,只需删除所有<iframe>元素:

foreach(HtmlElement x in ((WebBrowser) sender).Document.GetElementsByTagName("iframe")) { x.OuterHtml = String.Empty; }

In the DocumentCompleted event for your WebBrowser, simply remove all the <iframe> elements:

foreach(HtmlElement x in ((WebBrowser) sender).Document.GetElementsByTagName("iframe")) { x.OuterHtml = String.Empty; }

更多推荐

本文发布于:2023-07-27 15:26:00,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1292395.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:控件   如何在   NET   webbrowser   Explorer

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!