Добрый день!При попытке подписки на сайте https://gauntface.github.io/simple-push-demo/ выдает вот такую ошибку: http://prntscr.com/ml061v
Как я понял,не хватает этого кода:
ServiceWorkerRegistration.prototype.showNotification
Но как добавить его в Human Emulator?
Push уведломления
Re: Push уведломления
Попробуйте browser->set_init_java_script или через JS расширения - папка Plugins\CEF Extensions
-
- Сообщения: 3
- Зарегистрирован: 14 фев 2019, 14:50
Re: Push уведломления
Попробовал оба метода,1 метод недоступен в демо версии,второй метод-сделал .JS расширение,перестали загружаться страницы,ошибок нет в Human Emulator.Может не то ввел?
Вот сам код :
Код: Выделить всё
;window.Notification = function(title, data) {
this.title = title
this.body = ""
this.data = null
this.dir = "auto"
this.lang = ""
this.tag = ""
this.icon = ""
if (data)
Object.assign(this, data);
var self = this
setTimeout(function() {
if(self.onshow)
self.onshow()
if(self.onclose)
setTimeout(function() {
self.onclose()
},2000)
}, 10)
};
try{
ServiceWorkerRegistration.prototype.showNotification = function(){}
}catch(e){}
window.Notification["permission"] = "granted"
window.Notification["requestPermission"] = function(c){c("granted");}
Re: Push уведломления
А так если:
browser->et_init_java_script("ServiceWorkerRegistration.prototype[\"showNotification\"] = function(title,option=\"\") { };")
-
- Сообщения: 3
- Зарегистрирован: 14 фев 2019, 14:50
Re: Push уведломления
Выдает вот такое:
Код: Выделить всё
browser->et_init_java_script("ServiceWorkerRegistration.prototype[\"showNotification\"] = function(title,option=\"\") { };")
^
SyntaxError: Unexpected token >
at new Script (vm.js:83:7)
at createScript (vm.js:267:10)
at Object.runInThisContext (vm.js:319:10)
at Module._compile (internal/modules/cjs/loader.js:684:28)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:732:10)
at Module.load (internal/modules/cjs/loader.js:620:32)
at tryModuleLoad (internal/modules/cjs/loader.js:560:12)
at Function.Module._load (internal/modules/cjs/loader.js:552:3)
at Function.Module.runMain (internal/modules/cjs/loader.js:774:12)
at executeUserCode (internal/bootstrap/node.js:342:17)