safari push notifications Just don't work for me

So, I can't figure this out.


I have the following JavaScript for signing up for push notifciations. (I've put it at the bottom of this question).


I don't get prompted to request permission to allow push notifications, and I get a straight 'denied'.


I've checked in safari preferences, that nothing is blocking notifications, and even logged on as a guest on my Mac.


I can't see any problems in the OSX Console.


On my web server, the log endpoint i.e https://SERVER/v1/log doesn't get hit. I'm logging any requests to this, to a database. I've tested it and the logging is working.



My SERVER is hosted and I haven't got access to the log files. I'm not sure how I can go about resolving this issue.


Anyone got any ideas?


<script>

var pushId = "web.com.myserver";

var subscribe = document.querySelector("#subscribe");

subscribe.addEventListener("click", function(evt) {

pushNotification();

}, false);

var pushNotification = function () {

"use strict";

if ('safari' in window && 'pushNotification' in window.safari) {

var permissionData = window.safari.pushNotification.permission(pushId);

checkRemotePermission(permissionData);

} else {

alert("Push notifications not supported.");

}

};



var checkRemotePermission = function (permissionData) {

"use strict";

if (permissionData.permission === "default") {

console.log("The user is making a decision");

window.safari.pushNotification.requestPermission(

"https://MYSERVER",

pushId,

{

"id": "123"

},



checkRemotePermission

);

}

else if (permissionData.permission === "denied") {

console.dir(arguments);

}

else if (permissionData.permission === "granted") {

console.log("The user said yes, with token: "+ permissionData.deviceToken);

}

};



</script>

Hey spenderuk,


We also trying to integrate web push notification and encountered with same issue that you have got.


It would be great if you can let us know how you turn it out.


Appreciate your help

safari push notifications Just don't work for me
 
 
Q