/// <summary> /// 跳转地址都改为在webbrowser中进行跳转 /// </summary> /// <param name="items"></param> private void SetAllWebItemSelf(HtmlElementCollection items) { try { foreach (HtmlElement item in items) { if (item.TagName.ToLower().Equals("iframe", StringComparison.OrdinalIgnoreCase) == false) { try { item.SetAttribute("target", "_self"); } catch { } } else { try { HtmlElementCollection fitems = item.Document.Window.Frames[item.Name].Document.All;
this.SetAllWebItemSelf(fitems); } catch { } } } } catch { } }
C# 防止连接跳出webbrowser界面
最新推荐文章于 2021-08-05 20:22:28 发布