加载外部网址时出现Phonegap错误?

时间:2013-03-08 17:12:31

标签: javascript html ios cordova

我正在尝试在我的iOS手机屏幕应用程序中加载外部网址。

我在 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.

**我确实将cordoba.plist中的OpenAllWhitelistURLsInWebView改为是。

任何想法??

1 个答案:

答案 0 :(得分:0)

你的www文件夹中有next.html吗?您的代码正在尝试加载apache.org而不等待它加载,它试图加载next.html。如果www文件夹中没有next.html,则会出现此错误。

相关问题