如何阻止WebView内的_blank链接启动IE,改为WebView本身打开。
或者有设置IE cookie的方法也可以
Hi
在win 8.1中有个关于webView的新事件叫NavigationStarting,参考http://msdn.microsoft.com/en-us/library/windows/apps/windows.ui.xaml.controls.webview.navigationstarting,可以通过过滤来获取链接,然后在webview中展现。
在8.0中的办法比较麻烦,需要过滤整段HTML代码,你可以用以下代码来获取当前页面所有的HTML
WebView webView = sender as WebView; string html = webView.InvokeScript("eval", new string[] { "document.documentElement.outerHTML;" });
James He MSDN Community Support | Feedback to us Develop and promote your apps in Windows Store Please remember to mark the replies as answers if they help and unmark them if they provide no help.
HI
1。NavigationStarting无法捕捉到_blank链接的操作事件。
2。win8时提供的这个方法只能在NavigationCompleted以后使用。当网页没有加载完成时,用户点击了网页内含有_balnk的链接仍然会有问题
你好!
虽然过去很久了 但是我找到了解决方法 回复一下楼主
主要是利用NewWindowRequested这个方法来实现楼主禁止默认浏览器这个想法
具体文档在https://docs.microsoft.com/en-us/uwp/api/Windows.UI.Xaml.Controls.WebView#Windows_UI_Xaml_Controls_WebView_NewWindowRequested此页