(PhoneGap的/ JS)window.close()的使用本地构建不执行 [英] (Phonegap / JS) window.close() is not executed using local build

查看:221
本文介绍了(PhoneGap的/ JS)window.close()的使用本地构建不执行的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个非常不好的问题。事实上,如果我想在本地建立我的PhoneGap的应用程序,始终遵循Android上的错误应用的回报:

I have a very bad issue. In fact if I want to build my Phonegap app locally, the app returns always following error on Android:

net::ERR_CONNECTION_REFUSED(http://localhost/?code=4/........)

因此​​,应用程序可以访问到本地主机 - 这是正确的!没有Web服务器。但我已经用于关闭窗口,如果InAppBrowser得到这个错误的loadStart事件 - 但为什么当我在本地编译这个程序,我的设备得到这个错误,而不是InAppBrowser

So, the app can get access to localhost - it's right! There is no Web Server. But I've used the loadStart event for closing the window if the InAppBrowser get this error - but why does my device get this error and not the InAppBrowser when I compile this app locally?

    $(authWindow).on('loadstart', function(e) {
    var url = e.originalEvent.url;
    var code = /\?code=(.+)$/.exec(url);
    var error = /\?error=(.+)$/.exec(url);

    if (code || error) {
        //Always close the browser when match is found
        authWindow.close();
    }

此例如使用基于云的构建工作正常。但我的本地系统上它不工作。有什么可以解决这个问题怎么办?

This example works fine using the cloud-based build. But on my local system it's not working. What can I do for solving this problem?

问候,
丹尼斯

Regards, Dennis

推荐答案

对于那些谁对这个职位绊倒,我的问题是,我并没有包括的index.html cordova.js

For those who stumble on this post, my issue was that I did not include cordova.js in index.html

<script src="cordova.js"></script>  

这篇关于(PhoneGap的/ JS)window.close()的使用本地构建不执行的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆