OneSignal / react-onesignal

React OneSignal Module: Make it easy to integrate OneSignal with your React App!
Other
73 stars 26 forks source link

[Bug]: Brave browser blocks SDK script #118

Closed promisetochi closed 1 year ago

promisetochi commented 1 year ago

What happened?

Brave browser blocks onesignal scripts. Is it okay to rename onesignal script files and serve them directly on the host applications domain?

image

What browsers are you seeing the problem on?

Brave

What operating system are you running?

MacOS Sonoma

Steps to reproduce?

1. Install
2. Call OneSignal.init() in a react hook
3. Browser blocks https://cdn.onesignal.com/sdks/web/v16/OneSignalSDK.page.js

What did you expect to happen?

Expected script to lead and evaluate

Relevant log output

GET https://cdn.onesignal.com/sdks/web/v16/OneSignalSDK.page.js net::ERR_BLOCKED_BY_CLIENT
jkasten2 commented 1 year ago

@promisetochi This is a known issue with both v15 and v16 of the OneSIgnal SDK with Brave. It seems the Brave browser is blocking the OneSignal Service Worker import, even when shields are down. This seems like a bug, as shields down should let things through so I recommend reporting this issue to them.

See this comment for more details: https://github.com/OneSignal/OneSignal-Website-SDK/issues/526#issuecomment-978354383

promisetochi commented 1 year ago

@jkasten2 thanks for the response.

It seems like an issue that OneSignal should be concerned about though. Browsers are basically (intentionally or unintentionally) defeating the purpose of the product.

iOS Safari also seems to block OneSignal scripts as well and this is a setting that seems to be on by default. Mixpanel will be an easy fix for me by renaming and moving the js file to our domain, not sure if that's possible with OneSignal. If there are any guides on self-hosting, could you please point to it?

IMG_F737DAAE55C0-1

AndreMiras commented 4 months ago

Would it be helping if the OneSignalSDKWorker.js script was embed with react-onesignal and served from the same domain?