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

Cannot read property 'parentWindow' of null #27

Closed
srhyne opened this issue Mar 2, 2019 · 2 comments
Closed

Cannot read property 'parentWindow' of null #27

srhyne opened this issue Mar 2, 2019 · 2 comments

Comments

@srhyne
Copy link

srhyne commented Mar 2, 2019

@Aaronius we are using Penpal for embedded lessons in ConveYour.com. We ❤️ it! Thank you!

I just upgraded from 3.0.7 to 3.1.0 and now we are getting this exception often. Here's the related line.

const child = iframe.contentWindow || iframe.contentDocument.parentWindow;

It looks like in the previous version this variable was set prior to handleMessage method being created so held in a closure (right?).

What should I change in my setup to make sure I'm compliant with this change? Thank you!

@srhyne
Copy link
Author

srhyne commented Mar 2, 2019

More on this.. It seems as though, this handleMessage would only fire when the parent receives a message from the child and that's only going to happen when the child is already in the DOM. I'm going to try to do some console log's on this to figure out what event or iframe state is causing this.

@Aaronius
Copy link
Owner

Aaronius commented Mar 6, 2019

@srhyne I ended up fixing this issue in this commit and releasing it in version 3.1.1. It doesn't resolve the concerns I outlined in #28 (comment), though. I'm still thinking that through.

@Aaronius Aaronius closed this as completed Mar 6, 2019
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