Question:
Would like to set up so that if permission request accepted - redirect a user to one sub-domain. If denied then to another sub-domain
Answer:
The code that will work at the moment of accepting or declining the permissions:
(function () {
var deniedLocation = 'https://google.com';
var successLocation = 'https://facebook.com';
Pushwoosh.push(['onSubscribe', function() {
window.location = successLocation;
}]);
Pushwoosh.push(['onPermissionDenied', function() {
if (Pushwoosh.permissionOnInit !== 'default') {
return;
}
window.location = deniedLocation;
}]);
})();
And the following code will work with already given permissions:
(function () {
var deniedLocation = 'https://google.com';
var successLocation = 'https://facebook.com';
Pushwoosh.push(['onReady', function() {
switch (Pushwoosh.permissionOnInit) {
case 'denied':
window.location = deniedLocation;
break;
case 'granted':
window.location = successLocation;
break;
default:
return;
}
}]);
Pushwoosh.push(['onSubscribe', function() {
window.location = successLocation;
}]);
Pushwoosh.push(['onPermissionDenied', function() {
window.location = deniedLocation;
}]);
})();
Comments
0 comments
Please sign in to leave a comment.