Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

window.webkit.messageHandlers undefined after iframe triggers navigation action #1261

Open
3 tasks done
elisemn opened this issue Sep 23, 2022 · 3 comments
Open
3 tasks done

Comments

@elisemn
Copy link

elisemn commented Sep 23, 2022

Bug Report

Problem

An iframe in our app triggers a navigation action via window.open or window.top.location.href to a url that is in our allow-intent allow list. The url is correctly opened in the system browser. However after it is opened window.webkit.messageHandlers is undefined which causes runtime errors within the cordova exec.js file when it attempts to use the cordova message handler to post a message.

TypeError
null is not an object (evaluating 'window.webkit.messageHandlers.cordova')

What is expected to happen?

The URL opened by the iframe should be opened in the system browser without triggering errors within the cordova app.

What does actually happen?

After the URL is opened window.webkit.messageHandlers undefined errors occur

Information

Command or Code

Environment, Platform, Device

This issues appears to happen on any iOS mobile device.

Version information

Cordova Packages:

    cli: 11.0.0
        common: 4.0.2
        create: 4.0.0
        lib: 11.0.0
            common: 4.0.2
            fetch: 3.0.1
            serve: 4.0.0

Project Installed Platforms:

    ios: 6.2.0

Checklist

@dpogue
Copy link
Member

dpogue commented Sep 23, 2022

To clarify: when you say "system browser" you mean opening in Safari (or Chrome, etc.) and leaving the Cordova app, right?

and then webkit.messageHandlers is undefined when you return to the Cordova app?

@dpogue
Copy link
Member

dpogue commented Sep 23, 2022

Also, the linked bug has some mention of App-Bound Domains, which aren't something that has been thoroughly tested on the Cordova side. Is your app using App-Bound Domains?

@elisemn
Copy link
Author

elisemn commented Sep 23, 2022

To clarify: when you say "system browser" you mean opening in Safari (or Chrome, etc.) and leaving the Cordova app, right?

and then webkit.messageHandlers is undefined when you return to the Cordova app?

Correct

Also, the linked bug has some mention of App-Bound Domains, which aren't something that has been thoroughly tested on the Cordova side. Is your app using App-Bound Domains?

It does look like our app is setting a number of WKAppBoundDomains and the iframe url is not one of them. I can investigate updating them.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants