<div data-role="footer" data-position="fixed" >
<div data-role="navbar" data-position="fixed">
<ul>
<li>
<a href="index.html#main_menu" rel="external" data-icon="home">Home</a>
</li>
</ul>
</div>
</div>
当我在我的phonegap应用程序中尝试此代码时,我得到以下错误。我知道这可能是可能的复制。(它在三星选项卡中完美运行但不在Huwavi中)
Application Error - The connection to the server was unsuccessful. (file:///android_asset/www/index.html)
答案 0 :(得分:1)
这是由您的App超时引起的。您可以在应用程序中增加超时值 在加载应用程序URL之前,将此行添加到java类。
super.setIntegerProperty("loadUrlTimeoutValue", 60000);
答案 1 :(得分:1)
您需要增加“loadUrlTimeoutValue”
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
super.loadUrlTimeoutValue = 15000;
loadUrl("file:///android_asset/www/index.html");
if (Build.VERSION.SDK_INT >= VERSION_CODES.JELLY_BEAN)
appView.getSettings().setAllowUniversalAccessFromFileURLs(true);
appView.getSettings().setNavDump(false);
}
答案 2 :(得分:1)
可能是由于尝试调试造成的。我在index.html中有一个weinre链接,看不到我的服务器 - 我删除了它,问题似乎消失了。实际上,任何加载不可用资产的尝试都可能导致超时。