feat: Enable opening system browser app in Browser plugin
See original GitHub issueFeature Request
Describe the Feature Request
Browser capacitor plugin now always opens a “pop-up” in-app browser. It would be useful to be able to open system browser app (Chrome, Safari…) instead. Cordova version of this plugin enables that by passing “_system” as window name, the capacitor version does not. Capacitor plugin does have a windowName option, but it does not work in a similar matter.
Currently it is possible to achieve the requested behaviour by using cordova InAppBrowser plugin. However, it would be nice if we could stick to the capacitor plugin.
Thanks.
Platform Support Requested
- Android
- iOS
- Electron
- Web
Describe Preferred Solution
This code
Browser.open({
url: "https://www.google.com",
windowName: "_system"
})
could open browser app in similar matter as cordova plugin does.
Describe Alternatives
More intuitive solution could be to add a new prop to BrowserOpenOptions
interface.
Browser.open({
url: "https://www.google.com",
systemBrowser: true
})
Or add a new method:
Browser.openSystemBrowser({
url: "https://www.google.com"
})
Related Code
Additional Context
Cordova plugin API: https://cordova.apache.org/docs/en/latest/reference/cordova-plugin-inappbrowser/#cordovainappbrowseropen
Issue Analytics
- State:
- Created 3 years ago
- Comments:7 (1 by maintainers)
For anyone coming to this thread looking for answers, it seems the native app is still under the same security limitations as the browser in that if you take too long to
window.open()
after a user action (i.e a slow API call) then it will silently fail.To make sure you can always open native Safari use
window.location = url
@jayenashar you might be looking for this?
https://capacitorjs.com/docs/apis/app-launcher#openurl