You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
<scriptsrc="https://cdn.onesignal.com/sdks/OneSignalSDK.js" async=""></script><script>varOneSignal=window.OneSignal||[];OneSignal.push(function(){OneSignal.init({appId: "26e25b26-86b2-4234-bd44-3b7f9365c735",// replace your id autoRegister: false,notifyButton: {enable: false,},});});</script>
Next, you'll need to add the OneSignal SDK files to your site. To do so,
Download the files here
Unzip the OneSignal SDK files. There should be three files:
Upload the OneSignal SDK files to the top-level root of your site directory, making them publicly accessible.
A custom notification button
<ahref="#" id="subscribe-link" style="display: none;">Subscribe to Notifications</a><script>functionsubscribe(){OneSignal.push(["registerForPushNotifications"]);event.preventDefault();}varOneSignal=OneSignal||[];/* This example assumes you've already initialized OneSignal */OneSignal.push(function(){// If we're on an unsupported browser, do nothingif(!OneSignal.isPushNotificationsSupported())return;OneSignal.isPushNotificationsEnabled(function(isEnabled){if(isEnabled){// The user is subscribed to notifications// Don't show anything}else{document.getElementById("subscribe-link").addEventListener('click',subscribe);document.getElementById("subscribe-link").style.display='';}});});</script>