GM.notification: Difference between revisions

From GreaseSpot Wiki
Jump to navigationJump to search
Created page with "== Description == This method opens the specified URL in a new tab. == Syntax == {{Function|GM.notification|text, title, image, onclick}} Compatibility: Version_history#..."
 
Lil Devil (talk | contribs)
fix description
Line 1: Line 1:
== Description ==
== Description ==


This method opens the specified URL in a new tab.
This method displays a notification to the user, using the underlying operating system's notification mechanism.


== Syntax ==
== Syntax ==

Revision as of 13:41, 16 July 2018

Description

This method displays a notification to the user, using the underlying operating system's notification mechanism.

Syntax

function GM.notification( text, title, image, onclick )

Compatibility: Greasemonkey 4.0+

Arguments

text
String The main notification text.
title
String The title of the notification.
image
String Optional: The URL for an image to display in the dialog. If not provided, the Greasemonkey logo by default.
onclick
Function Optional: callback, triggered when the notification's button is clicked.

Returns

undefined

Examples

GM.notification("A new widget is available at the frobber.", "New widget!");

The appearance is platform specific, but could be for example: