Share your advanced knowledge/code with the community.
Peter
Posts: 1093 Joined: Mon Feb 24, 2014 10:17 pm
Location: 127.0.0.1:9080
Contact:
Post
by Peter » Fri Sep 14, 2018 2:42 pm
just a snippet...
Code: Select all
Procedure ShowNotificationCallback()
Debug "ShowNotificationCallback()"
EndProcedure
Procedure ShowNotification(Title.s, Message.s, Icon.s = "", Callback = #PB_Ignore)
! if (!Notification) {
Debug "This browser doesn't support desktop notification"
! return;
! }
! if (Notification.permission !== "granted") {
! Notification.requestPermission();
! } else {
! var notification = new Notification(v_title, { icon: v_icon, body: v_message, });
If Callback <> #PB_Ignore
! notification.onclick = function () { v_callback() };
EndIf
! }
EndProcedure
ShowNotification("Notification title",
"This is a simple desktop notification",
"http://icons.iconarchive.com/icons/paomedia/small-n-flat/64/cat-icon.png",
@ShowNotificationCallback())
Paul
Posts: 197 Joined: Wed Feb 26, 2014 6:46 pm
Location: Canada
Contact:
Post
by Paul » Fri Sep 14, 2018 6:50 pm
Using Chrome v68 here ... the page is blank (other than the default blue SpiderBasic background) and the debug window is empty.
Peter
Posts: 1093 Joined: Mon Feb 24, 2014 10:17 pm
Location: 127.0.0.1:9080
Contact:
Post
by Peter » Fri Sep 14, 2018 9:41 pm
Paul wrote: Using Chrome v68 here ... the page is blank (other than the default blue SpiderBasic background) and the debug window is empty.
please open the console (<F12>) and reload the page. Is there an error message?
Greetings ... Peter
Paul
Posts: 197 Joined: Wed Feb 26, 2014 6:46 pm
Location: Canada
Contact:
Post
by Paul » Fri Sep 14, 2018 10:08 pm
This is the error listed ...
Peter
Posts: 1093 Joined: Mon Feb 24, 2014 10:17 pm
Location: 127.0.0.1:9080
Contact:
Post
by Peter » Fri Sep 14, 2018 10:24 pm
Paul wrote:
ok, this is a 'normal' error message, because SpiderBasic does not create/copy the favicon file. Strange...
that's what it would look like if it worked for you:
(testet with Linux Chrome and Firefox and Windows 2012 Chrome and Firefox (IE doesn't work (of course))
Paul
Posts: 197 Joined: Wed Feb 26, 2014 6:46 pm
Location: Canada
Contact:
Post
by Paul » Sat Sep 15, 2018 12:57 am
This was annoying me so I went into my Chrome settings and found this (which I know is the port SpiderBasic uses) ...
I deleted it and then ran your code again and this time it worked.
I must have been doing something in the past which caused this entry to exist in Chrome.
Cool code snippet by the way