更改 WebBrowser 控件中的链接目标
有时,当我单击链接时,它会在新窗口中打开。我可以防止这种情况发生并仅在当前窗口中加载页面吗?
Sometimes when I click on a link, it opens in a new window. Can I prevent this from happening and just load the page in my current window?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
这对我有用(到目前为止):
非常简单,如果状态文本是网址(它始终适用于我正在浏览的文档)
This is working for me (so far):
Really simple, if the status text is the url (which it always is for the documents I am browsing)
如果您的目标是 Windows XP SP2 或更高版本,您可以捕获NewWindow3事件获取目标url,设置cancel参数后,导航到该url 反而。
对于早期版本的 IE,您可以使用 Q185538 中记录的相同处理方式捕获过时的 NewWindow 事件如何在同一 Web 浏览器窗口中进行导航
If you are targeting Windows XP SP2 or later, you can catch the NewWindow3 event to get the target url, and after setting the cancel parameter, navigate to the url instead.
For earlier versions of IE you can catch the obsolete NewWindow event with the same handling as documented in Q185538 How To Cause Navigation to Occur in Same WebBrowser Window