开发者

Chrome Extension Help - Send data to file to display notification

开发者 https://www.devze.com 2023-03-10 16:46 出处:网络
So I am creating a Chrome Extension, and I\'ve reached a point where I want to create a desktop notification that links to a forum thread.I\'m using jQuery to retrieve data from a server, which contai

So I am creating a Chrome Extension, and I've reached a point where I want to create a desktop notification that links to a forum thread. I'm using jQuery to retrieve data from a server, which contains the ID of the thread. Since the only way to do HTML in desktop notifications is to put it in a separate file, I need some way to pass the data onto the external notification file.

I've looked into message passing (http://code.google.com/chrome/extensions/messaging.html), but the data doesn't stay while the notification file is called.

Are there any ideas?

Thanks very much in advance! It is greatly appreciated开发者_运维知识库.

Carl L.


From a notification you can call your background page directly:

chrome.extension.getBackgroundPage().getCurrentThreadId();

You can also use URL parameters (which you would need to parse on notification's side):

webkitNotifications.createHTMLNotification("notification.html?threadid=100");
0

精彩评论

暂无评论...
验证码 换一张
取 消