dimanche 25 décembre 2016

Cordova - how to redirect to another page. Always open in new external browser

In my index.html file I have window.location='http:....', and I am able to release the application to android.

When running the application on an android phone, i am asked what browser I should open it with, chrome or browser.

Obviously, my intention is to run the external application as a phonegap application.

Is this not posbbile?

This guide also suggests this to be possible:

http://ift.tt/2hElxvY

index.html

<!DOCTYPE html>
<html>
<head>
    <!--
        <meta http-equiv="Content-Security-Policy" content="default-src 'self' data: gap: https://ssl.gstatic.com 'unsafe-eval'; style-src 'self' 'unsafe-inline'; media-src *; img-src 'self' data: content:;">
    -->
    <meta name="format-detection" content="telephone=no">
    <meta name="msapplication-tap-highlight" content="no">
    <meta name="viewport" content="user-scalable=no, initial-scale=1, maximum-scale=1, minimum-scale=1, width=device-width">
</head>
<body>
    <script type="text/javascript" src="cordova.js"></script>
    <script type="text/javascript">

        document.addEventListener("deviceready", function() {
            window.location = "http://ift.tt/2hoETJ7";
        }, false);
    </script>
</body>
</html>

config.xml

<?xml version='1.0' encoding='utf-8'?>
<widget id="mycmpany.tv" version="0.0.1" xmlns="http://ift.tt/18Fk3Vk" xmlns:cdv="http://ift.tt/1cHnIYX">
    <name>mycmpany.tv</name>
    <description>
        Watch Tv from all over the world, anywhere, everywhere.
    </description>
    <author email="mo@mycmpany.com" href="http://mycmpany.tv">
        mycmpany.tv team
    </author>
    <content src="index.html" />
    <plugin name="cordova-plugin-whitelist" spec="1" />

    <access origin="http://ift.tt/2hEqlBi" subdomains="true"/>

    <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">
        <preference name="android-minSdkVersion" value="18"/>
        <preference name="android-targetSdkVersion" value="23"/>

        <allow-intent href="market:*" />
    </platform>

    <platform name="ios">
        <allow-intent href="itms:*" />
        <allow-intent href="itms-apps:*" />
    </platform>

</widget>

What am I missing?

Note, I tried with the cordova.InAppBrowser but unfortunately you'd get the adress bar and all there, and still not a great solution.




Aucun commentaire:

Enregistrer un commentaire