我有一个用于dapps的web3 webview,webview可以在webview中打开一些链接,在默认浏览器中打开一些其他链接,直到现在我仍然不明白是什么问题,因为没有关于链接的规则,正如我所说的,webview随机选择在默认浏览器中打开哪些链接
public Web3View(@NonNull Context context, @Nullable AttributeSet attrs, int defStyleAttr) {
super(context, attrs, defStyleAttr);
init();
}
@Override
public void setWebChromeClient(WebChromeClient client) {
super.setWebChromeClient(client);
}
@Override
public void setWebViewClient(WebViewClient client) {
super.setWebViewClient(client);
}
@SuppressLint("SetJavaScriptEnabled")
public void init() {
jsInjectorClient = new JsInjectorClient(getContext());
webViewClient = new Web3ViewClient(jsInjectorClient, new UrlHandlerManager());
WebSettings webSettings = getSettings();
webSettings.setJavaScriptEnabled(true);
webSettings.setCacheMode(WebSettings.LOAD_DEFAULT);
webSettings.setBuiltInZoomControls(true);
webSettings.setDisplayZoomControls(false);
webSettings.setUseWideViewPort(true);
webSettings.setLoadWithOverviewMode(true);
webSettings.setDomStorageEnabled(true);
webSettings.setSupportMultipleWindows(true);
webSettings.setAllowUniversalAccessFromFileURLs(true);
webSettings.setAllowContentAccess(true);
webSettings.setLoadWithOverviewMode(true);
webSettings.setJavaScriptCanOpenWindowsAutomatically(true);
webSettings.setUserAgentString(webSettings.getUserAgentString()
+ "AlphaWallet(Platform=Android&AppVersion=" + BuildConfig.VERSION_NAME + ")");
WebView.setWebContentsDebuggingEnabled(false); //so devs can debug their scripts/pages
addJavascriptInterface(new SignCallbackJSInterface(
this,
innerOnSignTransactionListener,
innerOnSignMessageListener,
innerOnSignPersonalMessageListener,
innerOnSignTypedMessageListener,
innerOnEthCallListener), "alpha");
}
有没有解决方案可以强制整个应用程序在webview中打开链接而不是默认的手机浏览器?我想所有的链接打开内的网络视图
暂无答案!
目前还没有任何答案,快来回答吧!