PhoneGap does not open external website!

2

I'm starting with PhoneGap, and I found a problem: my app would need to open a page on facebook. But I can not make the PhoneGap App open a simple page on Globo.com (example), but for Desktop I can usually!

index.html :

<!DOCTYPE html>
<html>
    <head>
        <meta http-equiv="Content-Security-Policy" content="default-src *; script-src *; object-src *; style-src *; img-src *; media-src *; frame-src *; font-src *; connect-src *">    
        <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">
        <link rel="stylesheet" type="text/css" href="css/index.css">
        <title>Hello World</title>
    </head>
    <body>
    <br><br>
        <a href="www.globo.com">GLOBO</a>

        <iframe src="www.google.com.br/"></iframe>

        <script type="text/javascript" src="cordova.js"></script>
        <script type="text/javascript" src="js/index.js"></script>
        <script>

        </script>
    </body>
</html>

My config.xml:

<?xml version='1.0' encoding='utf-8'?>
<widget id="com.example.hello" version="1.0.0" xmlns="http://www.w3.org/ns/widgets" xmlns:cdv="http://cordova.apache.org/ns/1.0">
    <name>HelloWorld</name>
    <description>
        A sample Apache Cordova application that responds to the deviceready event.
    </description>
    <author email="[email protected]" href="http://cordova.io">
        Apache Cordova Team
    </author>
    <content src="index.html" />
    <plugin name="cordova-plugin-whitelist" spec="1" />
    <access origin="*" />
    <allow-navigation href="*" />
    <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>

Can anyone help me solve this situation?

Solved! The problem I believe is in the PhoneGap App, as the Android apk worked normally!

    
asked by anonymous 22.01.2017 / 05:56

1 answer

2

Guilherme, PhoneGap in its own documentation has a detailed explanation regarding Internet access by the Application. Follow the link:

link

I recommend you read it, because it is of great help.

Run the following commands on your terminal in the directory of your application:

$ cordova plugin add cordova-plugin-whitelist
$ cordova prepare

(If it's windows, you do not need $)

And add the following line to your config.xml :

<allow-navigation href="*" />

This line basically gives you permission to access all pages of the internet through your application.

NOTE: In your config.xml , check to see if you have any other <allow-navigation> tag, if you have it, you can delete it and copy the one I passed over.

    
07.12.2017 / 15:36