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

Issue on Firefox Browsers #184

Closed
bmd-bentar opened this issue Dec 21, 2016 · 2 comments
Closed

Issue on Firefox Browsers #184

bmd-bentar opened this issue Dec 21, 2016 · 2 comments

Comments

@bmd-bentar
Copy link

One of my users got an issue like this on his console log (Firefox Browser):
TypeError: window.safari is undefined OneSignalSDK.js(line5, col 2143)
TypeError: window.safari is undefined OneSignalSDK.js(line2, col 18947)

Any idea?
Thanks.

@jasonpang
Copy link
Contributor

jasonpang commented Dec 21, 2016

On Safari browsers only, window.safari is defined, and returns:

image

Our SDK calls window.safari.pushNotification.requestPermission to prompt the user to subscribe on Safari.


For Safari browsers:

It's easy for third-party scripts running on the user's site to override the window.safari variable. Often times, scripts do this to set a marker that the environment the script is running on is Safari. This isn't good because it overwrites the global window.safari variable with no way to bring it back.

The error here is with the 3rd party script, and I'm afraid once that variable has been overwritten, there's nothing that can be done to restore it.


For non-Safari browsers:

If your user was running on a Firefox browser, the user agent navigator.userAgent was set to a Safari-like string, and our SDK (which internally uses https://github.com/ded/bowser) tried to register the user as if he or she was on Safari.

This should not normally happen. The user may have had another Firefox extension that changes the user agent for testing (very unlikely), or was testing the site in Firefox's Dev Tools and mimicking a Safari device (possible), or something else happened that changed the user agent on the page.

@jasonpang
Copy link
Contributor

Feel free to reply if you have any other questions or concerns, but the above reply should be what you're looking for!

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