Inside a Visualforce page, I have a static resource (MyResource.zip) which contains the following:
- scripts/Script.js
- img/iconoTP.gif
I'm using the Chrome notifications API to show desktop notifications of events in this page.
The following code is inside script.js:
function notify(thetitle, thebody) {
if (!Notification) {
return;
}
if (Notification.permission !== "granted")
Notification.requestPermission();
else {
var notification = new Notification(thetitle, {
icon: URLFOR($Resource.MyResource,'img/iconoTP.gif'),
body: thebody,
});
}
}
And after calling the notify function, the line referencing the static resource throws an error because URLFOR isn't defined.
Is this possible in any way or should I upload my image in a different way? (i.e. not inside an static resource but as a document).
Note: this js file is correctly referenced in the VF page.
Best Answer
Found this on the Salesforce Developer forums. Maybe it will help you.