Plugin for iOS window.open

Hi, we are trying to test the plugin: cordova-plugin-wkwebview-engine-windowopen
(@zestia/cordova-plugin-wkwebview-engine-windowopen - npm)
to use the window.open command in iOS webview but the compiler don’t allow to use it.

Plugin cordova-plugin-wkwebview-engine-windowopen is not known to VoltBuilder. Please let us know if you need it.

Can be added?.
Thanks

Looking at this plugin in npmjs, it shows that is was downloaded just 19 times in the past week.

The plugin was last updated 2 years ago. That’s a lot of time for WKWebView, which has had a lot of updates in the meantime.

On npmsearch, the plugin has a score of 86. We prefer a score of 100.

Perhaps there is a better plugin for your needs?

this plugin is better? cordova-plugin-ionic-webview-openblank - npm

It’s still not great. The core code is the same. All the author did was update a dependancy version number. If you’re sure this is the only solution to the problem, we can greenlist it. My hunch is there may be a better solution.

Sorry i don’t see any another plugin to solve the problem.
The Cordova webview in iOS don’t allow open links in the browser and the plugin intercepts that calls and make the browser open.
It would be a helpful can you activate.
Thanks

OK, it should be added to day. Hopefully it works for you!

Thanks you, activate cordova-plugin-ionic-webview-openblank ? i still having the same error

It was just added a minute ago. Try again.

I also use this plugin for the same reasons. Thanks for adding it.

Are you just trying to force use of WebWKView? There’s an (AFAIK) official way using the existing official inappbrowser plugin.

    <preference name="WKWebViewOnly" value="true" />

    <feature name="CDVWKWebViewEngine">
        <param name="ios-package" value="CDVWKWebViewEngine" />
    </feature>

    <preference name="CordovaWebViewEngine" value="CDVWKWebViewEngine" />

    <plugin name="cordova-plugin-wkwebview-engine"/>
    <plugin name="cordova-plugin-inappbrowser"/>

Apple is no longer allowing the use of inappbrowser, and is rejecting all apps that include that plugin, so CDVWKWebview is the only way now as inappbrowser is depricated.

ITMS-90809: Deprecated API Usage - Apple will no longer accept submissions of new apps that use UIWebView as of April 30, 2020 and app updates that use UIWebView as of December 2020. Instead, use WKWebView for improved security and reliability. Learn more (UIWebView | Apple Developer Documentation).

But there might be a new solution to this problem in Cordova@6.1.0:

Add preference for webview window handling (New Feature)

Historically, Cordova iOS has not supported the creation of new webview windows with APIs like window.open or links with target="_blank" . The default behaviour was inconsistent, with some links opening externally in Safari and some links being unclickable. There is now an AllowNewWindows preference in config.xml to control the behaviour of new windows within the application.

  • When false (the default behaviour), links that would open a new window are instead opened in the same webview as if they had not requested a new window.
  • When true , links that would open a new window will create a new webview overtop of the app. This new webview provides no controls, so you must include a way to dismiss it with window.close() .

Links that are outside the list of allow-navigation URLs will continue to open in Safari.

… and if you want to build with cordova-ios 6.1.0, read this:

1 Like

The actual name is @zestia/cordova-plugin-wkwebview-engine-windowopen.

While its use rate is down from last time this came up, we are still adding it. It should be available in a couple of hours.

It’s there now.

2 Likes