Search code examples
google-chromegoogle-chrome-extensionhtml5-notificationswebkit-notifications

Use image file on other server as Icon of webkitnotifications


I'm making a Chrome Extension.

I want to use a image file on other servers as an icon of webkitnotifications(Desktop notifications)

in Content Script

window.webkitNotifications.createNotification(
    "http://www.example.com/icon48.png", "title", "text"
).show();

in manifest.json

"permissions": [
    "tabs", "notifications", "http://*/*", "https://*/*"
]

but I got the following error

Uncaught Error: SECURITY_ERR: DOM Exception 18 

The URL of the icon changes in many ways. So I cannot add all of them to "web_accessible_resources" in manifest.json beforehand. So, how can I do the above ?? Thank you very much in advance.


Solution

  • In my extension, with Chrome 23, I can point to external icon url like this without any problem

    var notification = webkitNotifications.createNotification(
        'http://placehold.it/48x48',  // no need to add to "web_accessible_resources" beforehand
        title,  // notification title
        textToDisplay // notification body text
    );