[英]Performance issue in phonegap and Jquery mobile
我在phonegap 3.0中遇到了一些性能問題。 我有兩個HTML頁面(我不想放在一起作為一個頁面)。 這兩個頁面都稱為jquery移動腳本和phonegap的deviceready函數。 我使用window.location =“ page2.html”之類的導航命令。
可以轉到page2.html,但是需要7秒鍾(我認為這是再次加載了腳本文件)。 所以我嘗試使用window.location.href =“ page2.html”。 它會立即在1秒鍾內轉到page2,但不能在page2中稱為頁面onload函數(aka:$(document).ready())。
我應該如何解決這個問題? 感謝您的任何建議或幫助!
編輯:
page1.html標頭功能
<script type="text/javascript" src="js/jquery-1.7.1.min.js"></script>
<script type="text/javascript" src="js/jquery.mobile-1.1.1.min.js"></script>
<script type="text/javascript" src="js/less-1.3.0.min.js"></script>
<link rel="stylesheet" href="css/reset.css">
<link rel="stylesheet" href="css/themes/default/jquery.mobile.structure-1.1.1.min.css" />
<link rel="stylesheet/less" href="css/style.css">
<div>
Please click here to <a style="font-weight:bold;font-size:13px;color:blue;" id="registerButton"
onclick="callanotherpage('page2.html');" >REGISTER</a> !
</div>
<script type="text/javascript">
$(document).ready(init);
function init(){
document.addEventListener("deviceready", function(){
},true);
$("#pageLoader").hide();
}
function callanotherpage(page_name){
window.location.replace(page_name);
}
在page2.html中
<script type="text/javascript" src="js/jquery-1.7.1.min.js"></script>
<script type="text/javascript" src="js/jquery.mobile-1.1.1.min.js"></script>
<script type="text/javascript" src="js/less-1.3.0.min.js"></script>
<link rel="stylesheet" href="css/reset.css">
<link rel="stylesheet" href="css/themes/default/jquery.mobile.structure-1.1.1.min.css" />
<link rel="stylesheet/less" href="css/style.css">
<script type="text/javascript">
$(document).ready(init);
function init(){
document.addEventListener("deviceready", function(){
},true);
$("#pageLoader").hide();
}
function callanotherpage(page_name){
window.location.replace(page_name);
}
</script>
最佳Rgds,達特蛙
只使用普通鏈接怎么辦?
<a href="page2.html">link</a>
我在3個不同的html頁面上有9000行代碼的應用程序。 每頁有9000行以上。 從一個站點到另一個站點的更改時間不超過1秒
嘗試使用
document.location = "page2.html";
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.