I'm currently using webview_flutter for webview appearance. But the problem is I can't find the way to get button tap on webview which is window.open(url)
or target="_blank"
.
I want to prevent when it matches above condition.onNavigationRequest
is provided to prevent but the solution how to get window.open(url)
or target="_blank"
is unknown because url is only url string.
final navigationDelegate = NavigationDelegate(
onNavigationRequest: (request) {
final url = request.url; // only url string not window.open() so I can't prevent
},
);
Due to some security I can't use inappwebview
Thank you a lot for your help.
Finally I can catch
window.open()
by using addJavaScriptChannel. Make a channel in WebView_flutter to listen whether you tap onwindow.open()
.