我收到错误“ 07-12 11:39:54.578:I / Web Console(21702):JSCallback错误:请求失败。位于file:///android_asset/www/js/cordova-1.8.1的.js:3725 “
我有2页,第一页正常加载没有错误,但是当我转到下一页时,logcat显示此错误。我在Google上搜索了一个答案,有些人说这是android清单的问题,但是添加了所有权限。
这是我的网页代码,第一页:
<!DOCTYPE HTML>
<html>
<head>
<title>List Mode</title>
<link rel="stylesheet" href="css/jquery.mobile-1.1.0.min.css" />
<link rel="stylesheet" href="css/style.css" />
<script type="text/javascript" src="js/cordova-1.8.1.js"></script>
<script type="text/javascript" src="js/jquery-1.6.4.min.js"></script>
<script type="text/javascript" src="js/jquery-ui-1.8.21.custom.min.js"></script>
<script type="text/javascript" src="js/jquery.mobile-1.1.0.min.js"></script>
<script>
var i = 0;
$('#listpage').live("swiperight", function () {
window.location.href = 'file:///android_asset/www/order.htm';
});
$('#pause').live('click', function(event){
i++;
if ($('#pause .ui-btn-text').text() == "Start")
{
$('#pause .ui-btn-text').text("Pause");
}
else
{
$('#pause .ui-btn-text').text("Start");
}
});
</script>
</head>
<body >
<div data-role="page" data-theme="c" id="listpage">
<input type ="radio" name="test" class="cityArea" id="kesklinn" /><label for="kesklinn">Kesklinn: </label>
<input type ="radio" name="test" class="cityArea" id="lasnamae" /><label for="lasnamae">Lasnamäe: </label>
<input type ="radio" name="test" class="cityArea" id="mustamae" /><label for="mustamae">Mustamäe: </label>
<input type ="radio" name="test" class="cityArea" id="pohja-tallinn" /><label for="pohja-tallinn">Põhja-Tallinn: </label>
<input type ="radio" name="test" class="cityArea" id="haabersti" /><label for="haabersti">Haabersti: </label>
<input type ="radio" name="test" class="cityArea" id="nomme" /><label for="nomme">Nõmme: </label>
<input type ="radio" name="test" class="cityArea" id="pirita" /><label for="pirita">Pirita: </label>
<div data-role="button" class="text" id="pause"> Start </div>
</div>
</body>
</html>
和第二个:
<!DOCTYPE HTML>
<html>
<head>
<title>New order</title>
<link rel="stylesheet" href="css/jquery.mobile-1.1.0.min.css" />
<link rel="stylesheet" href="css/style.css" />
<script type="text/javascript" src="js/cordova-1.8.1.js"></script>
<script type="text/javascript" src="js/jquery-1.6.4.min.js"></script>
<script type="text/javascript" src="js/jquery.mobile-1.1.0.min.js"></script>
<script type="text/javascript" src="js/orderpage.js"></script>
</head>
<body>
<div data-role="page" data-theme="c" id="orderpage">
<div id="address" class="text"> HERE COMES ADDRESS AND COMMENTS</div>
<div id="line"></div>
<table id="button_table">
<tr>
<td>
<div data-role="button" class="accept_button" data-a="1 Minute" id="1min">1</div>
</td>
<td>
<div data-role="button" class="accept_button" data-a="5 Minutes" id="5min">5</div>
</td>
<td>
<div data-role="button" class="accept_button" data-a="7 Minutes" id="7min">7</div>
</td>
<td>
<div data-role="button" class="accept_button" data-a="10 Minutes" id="10min">10</div>
</td>
</tr>
</table>
<div id="line"></div>
<div data-role="button" data-a="decline" class="decline_button" id="decline"> No,Thanks </div>
</div>
</body>
</html>
答案 0 :(得分:1)
window.location.href = 'file:///android_asset/www/order.htm';
仅在file:///android_asset/www/order.htm write order.html
的第一页的这一行中,请参阅o / p
答案 1 :(得分:0)
无需完整路径,只需编写
即可window.location.href = 'order.htm'