我需要一些帮助来阻止 Internet Explorer 或 .NET 网络浏览器控件中的 iframe。我尝试了安全首选项,但没有用。 XP 和 IE8,带有 .NET Framework 4.0
最佳答案
在DocumentCompleted
为您举办的事件 WebBrowser
, 只需删除所有 <iframe>
元素:
foreach(HtmlElement x in ((WebBrowser) sender).Document.GetElementsByTagName("iframe")) {
x.OuterHtml = String.Empty;
}
关于c# - 如何在 Internet Explorer 或 .NET Web 浏览器控件中阻止 iframe,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/8565733/