PhoneGap Build: how to open external url in device browser on Android?
It's not the answer when you want to keep using PhoneGap Build, but I solved the problem by setting up a development environment for Cordova (PhoneGap) on my machine and compiling the app locally. In Cordova 2.5.0 window.open('http://www.myurl.nl', '_system');
works perfect, it will open the link in the system's browser.
So my advice is to stop using PhoneGap Build and start compiling your app locally. Here's how to set up your development environment for Cordova >>
Open external links in Phonegap Build App (iOS/Android)
The solution for my problem was include phonegap.js file to my <head>
in all the pages where I will use the InAppBrowser: <script src="phonegap.js"></script>
I'm gonna explain a little, why this solution in first time doesn't seem logic to me (and maybe you too), but then I tried and it works.
This is what Phonegap in his plugin documentation section says:
"If a plugin utilizes the
js-module
element to direct cordova to load the plugin javascripts, then no<script>
references will be necessary to load a plugin. This is the case for the core cordova plugins"
InAppBrowser is a core cordova plugin. But for some strange reason don't work until you include the phonegap.js
file (at least in 0.3.3 version).
NOTE: I found a bug. Some people says that you have to include 3 files: phonegap.js
, cordova.js
and cordova_plugins.js
. But when I include this 3 files my app works fine in iOS 7, but in iOS 6 ignore the use of the plugin (Using: Cordova 3.3.0 + Phonegap Build + InAppBrowser 0.3.3).
Cordova 6 : how to stay in app when opening an external url?
Using the InAppBrowser Plugin you should be able to do:
cordova.InAppBrowser.open('http://apache.org', '_self', 'location=yes');
Notice the _self
target in the second parameter. This will open the site in the app's WebView.
Related Topics
CSS Replacement for <Div Align="Center">
Why Does Border: 5Px Dashed Not Come Out as Dashed in Firefox
Flexbox Horizontal Menu Centering While Keeping Last Element to The Right Side
Can an HTML Email Body Reference a File Sent as an Attachment (In The Same Email)
CSS-Only Detection of Text Overflows in HTML
Cross Browser Method to Fit a Child Div to Its Parent's Width
Are Nested Span Tags Ok in Xhtml
Why Is My .Sticky-Top Class Not Working in Bootstrap 4
Why Is My Background Color Not Showing If I Have Display: Inline
Why Does HTML5 Recommend Putting The Code Element Inside Pre
HTML to Excel: How Can Tell Excel to Treat Columns as Numbers
Balanced Text Wrapping in HTML
How to Display HTML Code (Entities) on a Web Page
Scale Svg to Container Without Mask/Crop
HTML Form File Uploads Doesn't Upload File