OneSignal / OneSignal-Website-SDK

OneSignal is a push notification service for web and mobile apps. This SDK makes it easy to integrate your website with OneSignal Push Notifications. https://onesignal.com
Other
383 stars 115 forks source link

[Bug]: [Firefox] Request to access cookie or storage on “https://cdn.onesignal.com/sdks/OneSignalSDK.js” was blocked because it came from a tracker and content blocking is enabled. #1149

Open quarryman opened 6 months ago

quarryman commented 6 months ago

What happened?

Starting from Firefox version 109 I am getting next error in console It's clear this comes from browser policy to prevent 3-d party services from tracking users.

I consider this is known however I didnt find direct best practice from OneSignal how to deal with it.

What browsers are you seeing the problem on?

Firefox

What operating system are you running?

macOS SONOMA 14.2

Steps to reproduce?

Add OneSignal CDN to page
Get error in console in Firefox

What did you expect to happen?

CDN script to execute and work without errors

Relevant log output

No response

jkasten2 commented 6 months ago

@quarryman Thanks for reporting, I was able to reproduce the warning in Firefox 121.0 with default settings, but everything continues to work correctly.

Request to access cookie or storage on “<URL>” was blocked because it came from a tracker and content blocking is enabled. 4

Request to access cookie or storage on “https://onesignal.com/sdks/OneSignalSDK.js” was blocked because it came from a tracker and content blocking is enabled.
Request to access cookie or storage on “https://cdn.onesignal.com/sdks/OneSignalPageSDKES6.js?v=151605” was blocked because it came from a tracker and content blocking is enabled.
Request to access cookie or storage on “https://onesignal.com/api/v1/sync/f246ca4c-d595-454b-8c7e-4ddfad76e978/web?callback=__jp0” was blocked because it came from a tracker and content blocking is enabled.
Request to access cookie or storage on “https://onesignal.com/sdks/OneSignalSDKStyles.css?v=2” was blocked because it came from a tracker and content blocking is enabled.

image Screenshot from Firefox 121.0's JS console

Work around to hide some console warnings

crossorigin="anonymous" can be added to the <script> tag where you include OneSignal, as noted by Mozilla's docs, however this only removes 2 of the 4 warnings.

Follow up

We will investigate more if this should be the new recommendation for integrating the OneSignal SDK. Also on how the other 2 warnings can be addressed.