2012-01-03 113 views
0

我在應用程序在phonegap中運行時加載外部HTML JQM片段時出現問題。載入屏幕短暫顯示,但沒有其他事情發生。無法使用PhoneGap將頁面更改爲JQM中的外部加載頁面

我已經縮小了一個問題,我把它放在github上,代碼非常簡單,https://github.com/edasque/simple_page_load_test

公共Android應用程序位於https://build.phonegap.com/apps/58244

這將作爲瀏覽器中的JQM應用程序(甚至是Android瀏覽器),並且在android模擬器中無問題地工作,但我無法在實際設備上運行。

該按鈕的作品,但不是頁腳按鈕,執行changePage到外部URL。 $ .mobile.allowCrossDomainPages設置爲true,$ .mobile.pushStateEnabled也設置爲true。我使用的是Phonegap 1.3,jQuery Mobile 1.0 & jQuery 1.6.4。

我已經在HTC Sensation上測試過了。這適用於Android SDK模擬器(2.1)。除了我的調試代碼,logcat中沒有任何內容出現。

回答

2

也有類似的問題.. 看我的代碼

<link rel="stylesheet" href="http://code.jquery.com/mobile/1.0/jquery.mobile-1.0.min.css" /> 
<script type="text/javascript" src="http://code.jquery.com/jquery-1.6.4.min.js"></script> 
<script> 
$(document).bind("mobileinit", function(){ 
$.mobile.allowCrossDomainPages = true; 
$.support.cors = true; 
$.mobile.pushStateEnabled=false; 
}); 
</script> 
<script type="text/javascript" src="http://code.jquery.com/mobile/1.0/jquery.mobile-1.0.min.js"></script> 
<script type="text/javascript" charset="utf-8" src="phonegap.js"></script> 

鏈接被定義爲

<a href="http://website-returning-jqm-pages" data-role="button" data-icon="info" data-iconpos="left">Info</a> 

我相信pushStateEnabled一定是假的,它的工作,因爲我也有過類似問題與上面的代碼。它在模擬器上工作,但不在設備上。 PhoneGap:構建調試在DOM中顯示響應,但在手機上沒有看到。

希望它有幫助..

+0

它確實幫助我,謝謝:) – 2012-04-02 13:41:10