Disclosure Statement: This site contains affiliate links, which means that I may receive a commission if you make a purchase using these links. As an eBay Partner, I earn from qualifying purchases.

Web Push notification

Post Reply
User avatar
salvadordf
Posts: 4052
Joined: Thu Feb 02, 2017 12:24 pm
Location: Spain
Contact:

Re: Web Push notification

Post by salvadordf »

Hi,

I haven't read the documentation about web notifications but after a quick search I found this :
http://www.magpcss.org/ceforum/viewtopi ... =20#p21753

There are no plans to add support for web notifications in CEF3 :cry:

...however... Marshall Greenblatt suggests that "You can define your own JavaScript bindings".

I could be wrong but if there's a way to receive those notifications at JS level, then you should be able to register a JS extension and send the notification to Delphi.

If someone wants to take a look, these pages describe the notification API :
http://www.html5rocks.com/en/tutorials/ ... ons/quick/
https://developer.chrome.com/extensions ... ifications
https://developer.chrome.com/extensions/notifications
https://developer.mozilla.org/en-US/doc ... tification
User avatar
salvadordf
Posts: 4052
Joined: Thu Feb 02, 2017 12:24 pm
Location: Spain
Contact:

Re: Web Push notification

Post by salvadordf »

There is a CEF4Delphi demo called "JSExtension" that shows all you need to register an extension, execute custom JS code and get the results in Delphi.

Read the code comments in the DPR and PAS files.
User avatar
salvadordf
Posts: 4052
Joined: Thu Feb 02, 2017 12:24 pm
Location: Spain
Contact:

Re: Web Push notification

Post by salvadordf »

Hi Enrico,

In CEF3 "registering a extension" means adding JS code that can include functions, values, etc.

I'm afraid I haven't had time to read all the documents I linked previously. My current knowledge about push notifications is very close to zero :oops:

However, CEF4Delphi has 9 demos in the JavaScript subdirectory describing :
  • How to send information from Delphi to JS and from JS to Delphi.
  • How to use Delphi functions from JS, and how to use JS functions from Delphi.
Before testing those demos you should read the CEF3 wiki about the Chromium process model :
https://bitbucket.org/chromiumembedded/ ... -processes
http://www.chromium.org/developers/desi ... ess-models

Then read the wiki page about JavaScript integration :
https://bitbucket.org/chromiumembedded/ ... gration.md

It is possible to access JS and the DOM from Delphi and vice versa but it must be done asynchronously with process messages because Chromium uses a several processes.
hvassbotn
Posts: 29
Joined: Tue Apr 25, 2017 3:02 pm
Location: Oslo, Norway
Contact:

Re: Web Push notification

Post by hvassbotn »

Hi Salvador,

Hope you are doing well! :)

We have been falling behind on CEF versions in our applications, but we were recently "forced" to upgrade from 60 to 85 (due to a 3rd party web app we need to support).

It was a quite tricky, as we had made some fixes and adjustments, but after 2-3 days, it is now working fine :).

The web app also uses standard Web push notifications. I understand that this was not supported in CEF 3 in 2017 - do you know if the situation is the same now? :)

Best regards
Hallvard Vassbotn
User avatar
salvadordf
Posts: 4052
Joined: Thu Feb 02, 2017 12:24 pm
Location: Spain
Contact:

Re: Web Push notification

Post by salvadordf »

Hi,

I'm fine thanks! :)

CEF and CEF4Delphi added support for several new features recently but I'm afraid that "web push notifications" is not one of them.

I'm hopeful that this CEF feature request will bring many new features once it's complete :
https://bitbucket.org/chromiumembedded/ ... -callbacks
If we could create a CEF browser window based on the “chrome” Browser object we would get much of the “chrome” layer functionality “for free”.
Post Reply