我正在尝试在我的iOS phonegap应用程序上加载外部url。
我使用这个在 index . html :
<!DOCTYPE html>
<html>
<head>
<title>window.open Example</title>
<script src="cordova-2.1.0.js"></script>
<script src="js/plugins/PushNotification.js"></script>
<script type="text/javascript" charset="utf-8">
// Wait for Cordova to load
//
document.addEventListener("deviceready", onDeviceReady, false);
// Cordova is ready
//
function onDeviceReady() {
// external url
var ref = window.open(encodeURI('http://apache.org'), '_blank', 'location=yes');
// relative document
ref = window.open('next.html', '_self');
}
</script>
</head>
<body>
</body>
</html>
但是我得到错误:
Failed to load webpage with error: The requested URL was not found on this server.
**我确实在科尔多瓦转了OpenAllWhitelistURLsInWebView
。选择"是"
任何想法?
你的www文件夹里有next.html吗?您的代码正在尝试加载apache.org,而没有等待它加载,它试图加载next.html。如果next.html不存在于www文件夹中,它会给出这个错误。