0

Trying to display an existing web page in a phonegap app. It seems like this was a big topic in 2014 but none of those answers seem to apply now.

Here is what I've done in index.html. It works in a web browser but not in the app. Has anyone worked this out? Maybe I am missing a permission somewhere?

<!DOCTYPE html>
<html>
    <head>
        <meta charset="utf-8">
        <meta name="viewport" content="initial-scale=1, maximum-scale=1, user-scalable=no, width=device-width">
        <title>Blank App</title>
    </head>
    <body onload="window.location.href='http://www.google.com'">
        <script type="text/javascript" src="cordova.js"></script>
        <p>hello</p>
    </body>
</html>

This also works in browser but not in phonegap...

<!DOCTYPE html>
<html>
    <head>
        <meta http-equiv="Refresh" content="0; url=https://www.google.com" />        
        <meta charset="utf-8">
        <meta name="viewport" content="initial-scale=1, maximum-scale=1, user-scalable=no, width=device-width">
        <title>Broken</title>
    </head>
    <body>
        <script type="text/javascript" src="cordova.js"></script>
    </body>
</html>

This also does not work...

<!DOCTYPE html>
<html>
    <head>
        <meta charset="utf-8">
        <meta name="viewport" content="initial-scale=1, maximum-scale=1, user-scalable=no, width=device-width">
        <title>Broken</title>
    </head>
    <body>
        <a href="" onclick="window.location.href='https://google.com'">HELLO</a>
        <script type="text/javascript" src="cordova.js"></script>
    </body>
</html>
Corbin
  • 313
  • 1
  • 3
  • 11

1 Answers1

0

Here it is, cost me $100 on upwork. I hope it saves somebody some headache!

<!DOCTYPE html>
<html>
    <head>
        <meta charset="utf-8">
        <meta name="viewport" content="initial-scale=1, maximum-scale=1, user-scalable=no, width=device-width">
        <title>Broken</title>
    </head>
    <body>
        <script type="text/javascript" src="cordova.js"></script>
        <script>
        document.addEventListener("deviceready", onDeviceReady, false);
        function onDeviceReady() {
            var ref = cordova.InAppBrowser.open('https://google.com', '_blank', 'location=no');
        }
        </script>
    </body>
</html>
Corbin
  • 313
  • 1
  • 3
  • 11