You are here: Home → Table of contents → Common Patterns → Testing whether a Greasemonkey function is available
4.2. Testing whether a Greasemonkey function is available
New versions of Greasemonkey expose new functions to user scripts. If you plan to distribute your user scripts, you should
check that the Greasemonkey functions you use actually exist.
Example: Alert the user if the GM_xmlhttpRequest
function is not available
if (!GM_xmlhttpRequest) {
alert('Please upgrade to the latest version of Greasemonkey.');
return;
}
// more code here that uses GM_xmlhttpRequest