Skip to content

Fix PubNub in iframe with 3rd party cookies disabled#35

Closed
jessepollak wants to merge 2 commits intopubnub:masterfrom
jessepollak:fix-iframe-cookie-issue
Closed

Fix PubNub in iframe with 3rd party cookies disabled#35
jessepollak wants to merge 2 commits intopubnub:masterfrom
jessepollak:fix-iframe-cookie-issue

Conversation

@jessepollak
Copy link

If PubNub is used in an iframe with 3rd party cookies disabled, it currently throws the following error:

Uncaught SecurityError: Failed to read the 'localStorage' property from 'Window': Access is denied for this document.

To fix this, we wrap the access of the localStorage object in a try/catch and polyfill if necessary.

…ded iframe in a browser with 3rd party cookies disabled
@stephenlb
Copy link
Member

this is a good fix, not a good implementation - but we need to add it to the unassembled/platform.js file which is used during the build process. https://github.com/pubnub/javascript/blob/master/web/unassembled/platform.js

@jessepollak
Copy link
Author

Happy to move it there when I'm back at my computer.
On May 20, 2014 7:23 PM, "Stephen L. Blum" notifications@github.com wrote:

this is a good fix, but we need to add it to the unassembled/platform.jsfile which is used during the build process.
https://github.com/pubnub/javascript/blob/master/web/unassembled/platform.js


Reply to this email directly or view it on GitHubhttps://github.com//pull/35#issuecomment-43705815
.

@jessepollak
Copy link
Author

Done.

@geremyCohen
Copy link

Thanks @jessepollak, we'll get this into our next JS release!
geremy

@jessepollak
Copy link
Author

jessepollak commented Aug 25, 2016

We are running into this problem again - it seems like the logic that was proposed here got reverted to something that fails completely in iframes with 3rd party cookies disabled.

Do y'all have any suggestion for how to handle this?

@MaxPresman
Copy link
Contributor

@jessepollak hey Jesse, are you targeting v3 or v4 of the SDK?

@jessepollak
Copy link
Author

I'm targeting v3. It looks like the "modern" version of the SDK (which I've realized is the only one available via npm) is doesn't have the try / catch, while the "browser" version does.

v4 has no try / catch at all.

@MaxPresman
Copy link
Contributor

@jessepollak let me double check on that regression; I'll cut a version for both v3 and v4 tomorrow to restore the exception handling.

@jessepollak
Copy link
Author

@MaxPresman thank you very much for the quick response!

@jessepollak
Copy link
Author

Hi @MaxPresman just wanted to follow up here - are you still planning on shipping a new version today?

@MaxPresman
Copy link
Contributor

@jessepollak the V4 is going through the deploy pipeline and V3 is coming up next; I am hoping within the next hour.

@jessepollak
Copy link
Author

Thank you!

On Thu, Aug 25, 2016 at 1:03 PM Max Presman notifications@github.com
wrote:

@jessepollak https://github.com/jessepollak the V4 is going through the
deploy pipeline and V3 is coming up next; I am hoping within the next hour.


You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
#35 (comment), or mute
the thread
https://github.com/notifications/unsubscribe-auth/ABDA4YxI9sHNOKRNmcgzXV9Dz9YTCR_Uks5qjfTggaJpZM4B8vg-
.

jesse pollak
jesse@pollak.io
→ register to vote: iOS http://bit.ly/2aigjW5 or web
http://bit.ly/2a0Rufc

@MaxPresman
Copy link
Contributor

@jessepollak all ready, 3.16.1 brings back the try..catch

@jessepollak
Copy link
Author

thanks so much!

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

Successfully merging this pull request may close these issues.

4 participants