如何在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; }更多推荐
发布评论