2012-01-18 46 views
0

我想用jQuery Mobile(1.0)在Android(2.1)上開發Phonegap(1.3)應用程序。jQuery手機 - Ajax驅動導航

我正在使用一本書(Pro jQuery Mobile)的例子,它適用於Firefox,但不適用於谷歌瀏覽器或android模擬器內部,我想知道爲什麼這不起作用。

的第一頁( 「的index.html」)的代碼是:

<!DOCTYPE html> 
<html> 
    <head> 
    <meta charset="utf-8"> 
    <title>Hijax Example</title> 
    <meta name="viewport" content="width=device-width, initial-scale=1"> 
    <link rel="stylesheet" href="http://code.jquery.com/mobile/1.0/jquery.mobile-1.0.min.css" /> 
    <script src="http://code.jquery.com/jquery-1.6.4.min.js"></script> 
    <script src="http://code.jquery.com/mobile/1.0/jquery.mobile-1.0.min.js"></script> 
</head> 
<body> 

<!-- First Page --> 
<div data-role="page"> 
    <div data-role="header"><h1>Hijax Page</h1></div> 
    <div data-role="content"> 
     <a href="contact.html" data-role="button">Contact Us</a> 
    </div> 
</div> 

</body> 
</html> 

第二頁( 「contact.html」)的代碼是:

<div data-role="page"> 
    <div data-role="header"> 
     <h1>Contact Us</h1> 
    </div> 

    <div data-role="content">  
     Contact information 
    </div> 
</div> 

我get是jQuery的「錯誤加載頁面」。

+0

看起來像路徑問題你嘗試用http://協議來定義contact.html的路徑嗎? – 2012-01-18 10:38:41

+0

+1它不適用於Chrome中的file://協議(但可以在Firefox中使用)。 – dfsq 2012-01-18 10:39:42

回答

0

它現在適用於Android模擬器。它沒有工作的原因是我包含了一個錯誤版本的Phonegap。我忘了phonegap-1.3.0.js是平臺依賴,我們包含Windows Phone版本,而不是Android版本。

不幸的是,它仍然無法在Chrome上使用。