0
在我的网页中,我已启用minify js和css调用。我曾尝试使用以下缓存android webview用于缩小js和css调用
mWebView.getSettings().setJavaScriptEnabled(true);
//mWebView.addJavascriptInterface();
mWebView.addJavascriptInterface(new MyJavascriptInterface(getActivity(), StartFragment.this.getActivity()), "MyJavascriptInterface");
String UserAgent = "Wifog android-" + versionCodestr + "/" + versionName;
mWebView.getSettings().setUserAgentString(mWebView.getSettings().getUserAgentString() + " " + UserAgent);
//in this call i set the webview client and the calls to process
setWebViewClient();
mWebView.setWebChromeClient(new WebChromeClient()
{
@Override
public void onReachedMaxAppCacheSize(long requiredStorage, long quota, WebStorage.QuotaUpdater quotaUpdater) {
quotaUpdater.updateQuota(requiredStorage*2);
}
});
mWebView.getSettings().setAppCacheMaxSize(1024 * 1024 * 8);
String appCachePath = getContext().getApplicationContext().getCacheDir().getAbsolutePath();
System.out.println("App- cache paht webview: "+appCachePath);
mWebView.getSettings().setAppCachePath(appCachePath);
mWebView.getSettings().setAllowFileAccess(true);
mWebView.getSettings().setDomStorageEnabled(true);
mWebView.getSettings().setAppCacheEnabled(true);
mWebView.getSettings().setCacheMode(WebSettings.LOAD_DEFAULT);
mWebView.getSettings().setPluginState(PluginState.ON);
mWebView.getSettings().setDatabaseEnabled(true);
if (Build.VERSION.SDK_INT < VERSION_CODES.KITKAT) {
mWebView.getSettings().setDatabasePath("/data/data/" + mWebView.getContext().getPackageName() + "/databases/");
}
但还是页面的缩小呼叫不被缓存,再而三打服务器启用针对Android的WebView的缓存更快的性能。我如何处理这在android中?
感谢..但是这并没有帮助。 。仍然那些minify js和css调用在这里 – beginner
你可以将这些文件保存在你的资产文件夹中 –
文件的大小是多少? –