Alex
Alex

Reputation: 1055

Chrome Background Page

Is it possible to have a background page checking another page, without an extra tab being open?

Im making an extension that checks if the user got a message on that site and will alert them, most likely using javascript.

Ive looked into it a bit. I know how ide script the extension and all, but don have a clue if it's possible to have it as an 'invisible' tab

Thanks for any help- Alex

Upvotes: 0

Views: 190

Answers (1)

Marius Kjeldahl
Marius Kjeldahl

Reputation: 6824

Yes, it is possible and well supported.

I have written a Chrome extension that periodically searches a site and give browser desktop notifications whenever new results are found. All that work is done in the background page. In addition, my extension also supports a popup icon (the ones to the right of the navbar), so the user can search manually whenever he wants. The popup page and background page run individually (so any common libraries you use - like jQuery - has to be loaded in both pages), but they can communicate through http://code.google.com/chrome/extensions/messaging.html .

As for avoiding the CORS/"same origin policy" issues, you need to make sure you extension is a packaged one (it's not supported for "hosted" extensions) and list any sites and protocols your extension need to access in the permissions part of the manifest file (you can use http://*/* and https://*/* if you want to be able to access any site).

Upvotes: 1

Related Questions