问题描述:

I am getting no display of the id suubscribe link when using the following onesignal script in a wordpress post. please tell me how to insrt the following script into a wordpress post so that it works

Click Here For Gmail Login | Gmail Sign-In Notifications

function subscribe() {

OneSignal.push(["registerForPushNotifications"]);

event.preventDefault();

}

 var OneSignal = OneSignal || [];

/* This example assumes you've already initialized OneSignal */

OneSignal.push(function() {

// If we're on an unsupported browser, do nothing

if (!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>

相关阅读:
Top