Open an external link in Safari (cordova)
You can embed javascript code in the href
attribute. This should do the trick:
<a href="javascript: window.open('http://www.sdtaproom.com/', '_system'); return false;">Visit Website</a>
You will also have to install the InAppBrowser plugin (don't be fooled by its name).
PhoneGap: Opening external URL's in Safari
Had the same problem after upgrading to Cordova 1.6.1.
Try adding target="_blank"
to your links.
That did the trick for me.
How to open a href link outside cordova webview (in Safari or Google Map)?
This is pretty simple to do, try to open it as if you open the link in a new tab. Just add this attribute to your code:
target="_blank"
So, you have:
<a href=""https://maps.google.com/?q=" + myAddressString target="_blank"> Address URL </a>
Cordova 3.0 - Open link in external browser in iOS
NOTE: to make window.open('somelink', '_system')
to work you now need a device-level plugin, the inAppBrowser. Here are the installing instructions as of Cordova 3.0
From the Docs for 3.0:
As of version 3.0, Cordova implements device-level APIs as plugins. Use the CLI's plugin command, described in The Command-line Interface, to add or remove this feature for a project:
$ cordova plugin add https://git-wip-us.apache.org/repos/asf/cordova-plugin-inappbrowser.git
$ cordova plugin rm org.apache.cordova.core.inappbrowser
These commands apply to all targeted platforms, but modify the platform-specific configuration settings described below:
iOS (in config.xml)
<feature name="InAppBrowser">
<param name="ios-package" value="CDVInAppBrowser" />
</feature>
I just tested this and it works.
Using Cordova, how can I open external URLs in Chrome, instead of the in-app browser?
Just going back through old questions and marking them as answered. I ended up doing this:
function onDeviceReady() {
return $(document).on('click', 'a[target="_blank"]', function(e) {
e.preventDefault();
return window.open(this.href, '_system');
});
};
if (!!window.cordova) {
document.addEventListener('deviceready', onDeviceReady, false);
}
Related Topics
Dismiss and Present View Controller in Swift
How to Change Swiftui Textfield Style After Tapping on It
How to Change the Height of Uitextfield in Uialertcontroller in Swift
Uitableview: Nested Section Headers
iOS 8.3 and Later, Facebook Share Text Not Inserted
Is This a Bug with Mkmapkitdelegate Mapview:Didupdateuserlocation
I Just Want to Open Ms Outlook App and See Mailto Screen Using Url Scheme at iOS
Missing iOS Development Signing Identity for (Null)
Memory Leak with "Libbacktracerecording.Dylib" in React Native iOS Application
iOS Lazy-Loading of Table Images
iOS 11 - Unable to Change Navigation Bar Height
How to Take Uiimage of Avcapturevideopreviewlayer Instead of Avcapturephotooutput Capture
Custom Uisearchbar with Uisearchcontroller
Making Uitableview with Embedded Uicollectionview Using Uitableviewautomaticdimension
Xcode 4.2 Mainstoryboard Not Found
Cannot Get My Location to Show Up in Google Maps in iOS 8
Why Don't My Views Show Up in Storyboards and Are Greyed Out in the Left Pane