window.open() with _system does not work with wkwebview (on cordova-ios 6.0.0)
See original GitHub issueBug Report
Problem
Safari does not open with wkwebview. With UIwebview, before the updates, it worked
window.open('https://google.com', "_self")
- this opens a new page in inappbrowser (as expected)
window.open('https://google.com', "_blank")
- nothing
window.open('https://google.com', "_system")
- nothing
I’ve tried also with <a href="https://google.com" target="_system">foo</a>
but nothing happens
What is expected to happen?
Open the system browser
What does actually happen?
Nothing
Information
Command or Code
Noteworthy lines on config.xml
<allow-navigation href="*" />
<allow-intent href="*" />
<access origin="*" />
Dependencies
"dependencies": {
"cordova-android": "^8.1.0",
"cordova-ios": "^6.0.0",
"cordova-plugin-androidx": "^2.0.0",
"cordova-plugin-androidx-adapter": "^1.1.1",
"cordova-plugin-browsertab": "0.2.0",
"cordova-plugin-buildinfo": "4.0.0",
"cordova-plugin-compat": "1.2.0",
"cordova-plugin-customurlscheme": "5.0.1",
"cordova-plugin-device": "^2.0.3",
"cordova-plugin-firebase-messaging": "^4.0.2",
"cordova-plugin-inappbrowser": "git+https://github.com/apache/cordova-plugin-inappbrowser.git",
"cordova-support-android-plugin": "^1.0.2",
"cordova-support-google-services": "^1.4.0",
"cordova-universal-links-plugin-fix": "1.2.1"
},
"devDependencies": {
"cordova-plugin-whitelist": "1"
},
"cordova": {
"plugins": {
"cordova-plugin-whitelist": {},
"cordova-plugin-firebase-messaging": {
"FIREBASE_ANALYTICS_VERSION": "17.2.+",
"FIREBASE_MESSAGING_VERSION": "20.1.+",
"ANDROIDX_CORE_VERSION": "1.0.+"
},
"cordova-plugin-device": {},
"cordova-plugin-buildinfo": {},
"cordova-universal-links-plugin": {},
"cordova-plugin-browsertab": {},
"cordova-plugin-customurlscheme": {
"URL_SCHEME": "----------------"
},
"cordova-plugin-androidx": {},
"cordova-plugin-androidx-adapter": {},
"cordova-plugin-inappbrowser": {}
},
"platforms": [
"ios",
"android"
]
}
Environment, Platform, Device
iOS 13.3 on Catalina simulator
Version information
cordova version: 9.0.0 (cordova-lib@9.0.1) cordova platform: cordova-ios 6.0.0 tested on: iOS 13.3 on Catalina simulator
Checklist
- I searched for existing GitHub issues
- I updated all Cordova tooling to most recent version
- I included all the necessary information above
Issue Analytics
- State:
- Created 3 years ago
- Comments:16 (1 by maintainers)
Top Results From Across the Web
Cordova ios with wkwebview plugin - window.open(url ...
I found a work-around for the issue with the @zestia/cordova-plugin-wkwebview-engine-windowopen plugin. Add to your project using: cordova ...
Read more >Cordova iOS 6.1.0 Released!
This release contains primarily fixes for issues with the 6.0.0 ... Cordova iOS has not supported the creation of new webview windows with ......
Read more >cordova-sqlite-storage - npm
Native interface to SQLite for PhoneGap / Cordova - cordova-sqlite-storage plugin version. Latest version: 6.1.0, last published: 14 days ...
Read more >cdvwkwebviewengine | The AI Search Engine You Control
Strict. Open links in a new tab ... [DEPRECATED] Apache Cordova wkwebview engine plugin ... However, you are still not able to use...
Read more >cordova-plugin-wkwebview-engine - npm package - Snyk
The official Apache Cordova WKWebView Engine Plugin For more information about ... Open Issues: 34 ... This plugin is not supported on cordova-ios...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
I solved this using latest version of cordova-plugin-inappbrowser install the plugin and change window.open whit cordova.InAppBrowser.open this way ,
cordova.InAppBrowser.open('https://www.google.com', '_system', 'hidden=yes,location=no')
and works perfect .https://cordova.apache.org/docs/en/latest/reference/cordova-plugin-inappbrowser/
I found that using
window.open()
inside a synchronousclick
event handler works, but if thewindow.open()
is called asynchronously (e.g. in an Angular rxjs observable), then it is blocked.This blocking behavior can be tested when you attach the Safari devtools, and then try to run
window.open()
from the Console, it will also returnnull
. However, if you attach a click event listener to any element from the Console, and call the same window.open() inside the handler, it will execute when clicking the element. This seems to be a Safari security feature.