yarek
yarek

Reputation: 12044

Cordova: how to open external url in the application without opening a new browser?

I use Cordova 6.3.

I tried many methods to open an external url while loading content in cordova

onDeviceReady: function() {
        app.receivedEvent('deviceready');       
        window.open('https://google.com', '_self ', 'location=yes');        
        navigator.app.loadUrl('https://www.google.com', { openExternal:false });
    },

It keeps on opening NEW browser !

How to open a external url inside the app ?

Upvotes: 2

Views: 7585

Answers (2)

Chris Neve
Chris Neve

Reputation: 2424

How about using the InAppBrowser plugin?

https://cordova.apache.org/docs/en/latest/reference/cordova-plugin-inappbrowser/

I have used it in my Cordova application - very easy to use.

Upvotes: 2

Hassan ALi
Hassan ALi

Reputation: 1331

Definition and Usage

The replace() method replaces the current document with a new one.

The difference between this method and assign(), is that replace() removes the URL of the current document from the document history, meaning that it is not possible to use the "back" button to navigate back to the original document.

<button onclick="myFunction()">Replace document</button>

    <script>
    function myFunction() {
        location.replace("http://www.w3schools.com")
    }
    </script>

try this hopefully that will help you .

Upvotes: 0

Related Questions