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是一個細節。
你的html標記應該包裹在'data-role = page'中。使用最新版本1.4,您使用的是舊版本。 – Omar
這樣做,讓它成爲答案,你有一個接受。 – CrazyCasta