0
拡張機能は、メッセージを受信したときに通知を送信します。新しい拡張機能を開く代わりに、Chrome拡張機能の更新を既に開いているようにします。
var notification = new Notification('New message', {
icon: icon,
body: dabody,
});
また、クリックしたときにメッセージを表示するページが開きます。
notification.onclick = function() {
window.open(link);
chrome.tabs.create({url: "https://website/messages/", selected: false, pinned: true}, function(tab) {
chrome.tabs.executeScript(tab.id, {
code: 'window.close();',
runAt: 'document_idle'
});
});
notification.close();
}
それは新しいページを開くのではなく、すでに開いている場合、私は/messages
ページの更新を持つことができる方法はありますか?
参照[ 'tabs.update()'](https://developer.chrome.com/extensions/tabs#method-update)。 – Makyen