|
请问各位大侠,我需要修改\Native\plugins\org.apache.cordova.inappbrowser\src\android\InAppBrowser.java内代码并使修改后生效(看了老外的帖子说是要重新编译,但不知道在哪里弄)Set the user-agent of the InAppBrowser webview to whatever the user-agent in the Cordova webview is set to. (This is what I am currently doing, as it was a one line change, but it requires rebuilding Cordova manually)(老外帖子的原话)
关键点是通过setUserAgentString函数设置UserAgent值
创建本地app我选模式4:打开非WeX5开发的网站
我的代码
final CordovaWebView thatWebView = this.webView;
.
.
.
// WebView
inAppWebView = new WebView(cordova.getActivity());
inAppWebView.setLayoutParams(new LinearLayout.LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT));
inAppWebView.setWebChromeClient(new InAppChromeClient(thatWebView));
WebViewClient client = new InAppBrowserClient(thatWebView, edittext);
inAppWebView.setWebViewClient(client);
WebSettings settings = inAppWebView.getSettings();
settings.setJavaScriptEnabled(true);
settings.setJavaScriptCanOpenWindowsAutomatically(true);
settings.setBuiltInZoomControls(true);
settings.setPluginState(android.webkit.WebSettings.PluginState.ON);
settings.setUserAgentString(thatWebView.getSettings().getUserAgentString() + "TestUserAgentString"); // 我增加的代码
另外问个小问题,如何不要splashscreen(启动画面) |
|