Im trying to use the new push notifications in Safari. I'm using the following snippet:
var checkRemotePermission = function (permissionData) {
if (permissionData.permission === 'default') {
// This is a new web service URL and its validity is unknown.
console.log("default");
window.safari.pushNotification.requestPermission('https://website.com/','web.com.website.notify',{uid: "TEST"},checkRemotePermission);
}
else if (permissionData.permission === 'denied') {
// The user said no.
console.log("no");
}
else if (permissionData.permission === 'granted') {
// The web service URL is a valid push provider, and the user said yes.
// permissionData.deviceToken is now available to use.
console.log("yes");
}
};
if ('safari' in window && 'pushNotification' in window.safari) {
var permissionData = window.safari.pushNotification.permission('web.com.website.notify');
checkRemotePermission(permissionData);
}else{
alert("This feature is only available on Mac OS X safari")
}
The problem is that I get no
in my javascript console, because the permission
is denied
. The thing is it never asked, nor has it ever asked before. Its not even in my safari preferences.
Why does safari return denied
without even asking?