I have a userscript that pops up a notification if certain content exists on the target page.
Under Tampermonkey/Chrome, this is not a problem. I can use the GM_Notification()
function to create notifications with ease.
When I try to do this under Firefox, it does not have the same behaviour whatsoever.
Checking in the logs there are no errors regarding the function, nor are their any notifications popping up.
Here is some sample code which does not work in Firefox+Greasemonkey or Firefox+Tampermonkey, but does work in Chrome+Tampermonkey:
// ==UserScript==
// @name Test Notifier
// @include *
// @grant GM_notification
// @grant window.focus
// ==/UserScript==
console.log('I am a pretty test script');
var notificationDetails = {
text: 'THIS IS A TEST NOTIFICATION!!!',
title: 'TEST',
timeout: 15000,
onclick: function() { window.focus(); },
};
GM_notification(notificationDetails);
Is this standard behaviour for Firefox? Does it handle HTML5 notifications in a completely different way (if at all)? and what's the common practice for enabling notifications in a Firefox userscript?