我需要在Phonegap应用程序中提供一些帮助.
CordovaWebView
我的应用程序中有一个.我需要从我的html(根据jQuery Mobile页面结构有多个页面)加载一个特定的页面,所以我这样使用loadUrl
:
cWebView.loadUrl("file:///android_asset/www/index.html#some-page-id");
这很好用.我能够看到some-page-id
.
现在我需要补充WebViewClient
的cWebView
.如果我这样做,我收到错误,并且webl中没有加载网址.
码:
cWebView.setWebViewClient(new MyCordovaWebViewClient(this, cWebView)); public class MyCordovaWebViewClient extends CordovaWebViewClient { public MyCordovaWebViewClient(CordovaInterface cordova, CordovaWebView view) { super(cordova, view); // TODO Auto-generated constructor stub } @Override public void onPageFinished(WebView view, String url) { // TODO Auto-generated method stub Log.d(TAG, "my page finished " + url); super.onPageFinished(view, url); } }
错误:
Application Error: A network error occurred. (file:///android_asset/www/index.html#some-page-id)
如果我只是加载index.html,而没有给出具体的页面ID,那么我就不会遇到任何问题setWebViewClient
.
任何setWebViewClient
与特定页面ID 一起使用的解决方案?