cordova远程android安卓应用 - 在web浏览器中加载所有其他链接

时间:2016-03-02 15:34:46

标签: javascript android cordova webview

所以我的应用程序应该非常简单,这是范围:

  1. 整个应用程序都是一个远程网站。

  2. 第一页是远程服务器上的登录信息。

  3. 登录后只需重定向到远程主页,因为网页会自动从浏览器进行(但留在应用程序中)。

  4. 主域中的所有链接都保留在应用中。

  5. 来自其他域的所有链接都打开了网络浏览器。

  6. 需要启用Cookie才能保持登录状态。

  7. 我不需要访问任何设备API,一切都在在线网站

  8. 我已经阅读了几篇关于如何使用Cordova实现此目的的文章,但我的问题是 - 第一页根据需要从服务器加载,但在我登录后,该应用程序在Web浏览器中打开主页。

    这是我的Cordova config.xml:

    <?xml version='1.0' encoding='utf-8'?>
    <widget id="com.myremoteapp" version="0.0.1" xmlns="http://www.w3.org/ns/widgets" xmlns:cdv="http://cordova.apache.org/ns/1.0">
        <name>Remote Web App</name>
        <description>
    Remote Web App description
        </description>
        <author email="contact@example.com" href="https://example.com">
        WebappAuthor
        </author>
        <content src="https://example.com/login" />
        <access origin="https://example.com" subdomains="true"/> 
        <plugin name="cordova-plugin-whitelist" spec="1" />
        <!--   <content src="index.html" />   -->
        <access origin="*" />
        <allow-intent href="http://*/*" />
        <allow-intent href="https://*/*" />
        <allow-intent href="tel:*" />
        <allow-intent href="sms:*" />
        <allow-intent href="mailto:*" />
        <allow-intent href="geo:*" />
        <platform name="android">
            <allow-intent href="market:*" />
        </platform>
        <platform name="ios">
            <allow-intent href="itms:*" />
            <allow-intent href="itms-apps:*" />
        </platform>
    </widget>
    

    注意:我刚刚编辑了这些行,以替换默认的本地index.html:

        <content src="https://example.com/login" />
        <access origin="https://example.com" subdomains="true"/>
        <!--   <content src="index.html" />   -->
    

    谢谢,非常感谢任何提示。

0 个答案:

没有答案