How do you communicate with the main page from the HTML notification?

I am working on a fork of the Twitter online client. ( Streamie , if you're interested.) I would like to improve Chrome notifications using HTML notifications instead of static ones. now uses.

The problem is that I need to get the twist object from the main page before the notification, and I'm not sure how to do it. In my Chrome extension, I circumvented this by creating an array with a queue of tweets to show by adding a function to the window object that returns queue.shift () and then calling that function through chrome.extension.getBackgroundPage().dequeueMsg();.

However, I obviously do not have this option in the web client. Is there a way to contact the notification with the window that opens it or from the page to the DOM notification?

+3
source share
1 answer

Good from spec:

In the web notification, the property window.openermust be set in the window in which the notification was created. If the notification was created by a working script, it window.openershould be null.

It looks like the code on the notification page can access window.openerexactly the same as the page created with window.open(). (Now, regarding the practical aspect of doing this with today's actual browsers, this is another thing I think.)

+1
source

Source: https://habr.com/ru/post/1788866/


All Articles