Phonegap加载缓存的外部站点

时间:2013-03-18 04:29:06

标签: android cordova webview

我创建了一个示例phonegap应用程序,用于加载外部URL。 html页面使用CACHE Manifest,我也在其中缓存主页面。

我第一次可以在android浏览器和phonegap应用程序中成功打开页面。此时应缓存所有文件。它正在被缓存。

所以,现在我关闭服务器并再次加载页面。在android浏览器中,我能够看到页面及其资源。但是在webview的情况下也不会发生这种情况。我收到错误无法打开网址。

我正在使用以下代码段。我在三星Galaxy标签,Android OS 3.0中进行了测试。我做错了什么?

@Override
public void onCreate(Bundle savedInstanceState)
{
    super.onCreate(savedInstanceState);
    super.loadUrl("http://(192.168.14.46):8080/CacheTest/index.html");

    this.appView.getSettings().setDomStorageEnabled(true);
    this.appView.getSettings().setAppCacheMaxSize(1024 * 1024 * 15);  

 this.appView.getSettings().setAppCacheEnabled(true); 

    String appCachePath = getApplicationContext().getCacheDir().getAbsolutePath();
    this.appView.getSettings().setAppCachePath(appCachePath);
    this.appView.getSettings().setAllowFileAccess(true);
    //this.appView.getSettings().setAppCacheEnabled(true);      

}

0 个答案:

没有答案
相关问题