2014-01-24 48 views
2

我写了一个webapp来跟踪我游泳的统计数据。它可以在我的桌面上正常工作,并且在android手机模拟器中很好,但是当我尝试在使用Android浏览器的Samsung Galaxy S2上使用它时,它只显示一堆代码。这发生在我登录之后。据我所知,下一页没有被加载。jQuery Mobile页面在三星Galaxy S2上提供代码

登录页面(不知道这是否是相关的)的代码是:

<html> 
    <head> 
     <title>Login</title> 
     <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> 
     <meta name="viewport" content="width=device-width, initial-scale=1" /> 
    </head> 
    <body> 
     <div data-role="header"> 

      <h1>Home</h1> 

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


<form action="" method="post"> 
    <div style='display:none'><input type='hidden' name='csrfmiddlewaretoken' value='ILxbxRYRNmNwIzUKASEtTbhGG9gtorZf' /></div> 
    <table> 
     <tr><th><label for="id_username">Username:</label></th><td><input id="id_username" type="text" name="username" maxlength="30" /></td></tr> 
<tr><th><label for="id_password">Password:</label></th><td><input id="id_password" type="password" name="password" maxlength="4096" /></td></tr> 
    </table> 
    <input type="hidden" name="next" value="/swimming/" /> 
    <input type="submit" value="Login" /> 
</form> 

     </div> 
     <div data-role="footer"> 

      <a href="/swimming/session/list" data-role="button">Session List</a> 
      <a href="/swimming/accounts/logout/" data-role="button">Logout</a> 

     </div> 
    </body> 
</html> 

目标页面的代码(/游泳/)是:

<html> 
    <head> 
     <title>Home</title> 
     <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> 
     <meta name="viewport" content="width=device-width, initial-scale=1" /> 
    </head> 
    <body> 
     <div data-role="header"> 

<h1>Home</h1> 

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


     </div> 
     <div data-role="footer"> 

      <a href="/swimming/session/list" data-role="button">Session List</a> 
      <a href="/swimming/accounts/logout/" data-role="button">Logout</a> 

     </div> 
    </body> 
</html> 

它吐出的代码是:

").append(d);return function(a){if(!(a in b)){var h=document.createElement("style"),g="@media "+a+" { #jquery-mediatest { position:absolute; } }";h.type="text/css";h.styleSheet?h.styleSheet.cssText=g:h.appendChild(document.createTextNode(g));e.prepend(f).prepend(h);b[a]=d.css("position")==="absolute";f.add(h).remove()}return b[a]}}()})(jQuery);(function(a,e){function b(a){var b=a.charAt(0).toUpperCase()+a.substr(1),a=(a+" "+c.join(b+" ")+b).split(" "),d;for(d in a)if(f[a[d]]!==e)return true}var d=a(" 

我很抱歉,如果我在我的描述中含糊不清,我对手机网页相当陌生,可能有m是一个细节。

+0

你的html标记应该包裹在'data-role = page'中。使用最新版本1.4,您使用的是旧版本。 – Omar

+0

这样做,让它成为答案,你有一个接受。 – CrazyCasta

回答

1

无论您使用的是多页面模型单页模型,所有的元素应该被包裹在<div data-role="page></div>

Page div就像每个页面的body标签一样。 jQuery Mobile寻找页面来创建它并增强其元素。

附注:我推荐使用最新的jQuery Mobile版本1.4

相关问题