[Greasemonkey] Suggestion: @min-version attribute

Mark Pilgrim pilgrim at gmail.com
Tue Apr 12 15:11:20 EDT 2005


On Apr 12, 2005 12:30 PM, Evan Martin <evan.martin at gmail.com> wrote:
> On Apr 12, 2005 6:58 AM, Mark Pilgrim <pilgrim at gmail.com> wrote:
> > Bad bad bad.  Use this instead:
> >
> > if (!GM_xmlhttpRequest) { alert('You need to upgrade Greasemonkey to
> > run this script.'); return; }
> >
> > Test features, not versions.
> 
> But that puts the burden on script authors to be aware of all previous
> incarnations of the GM API, to know which functions might be gone on
> older versions.

Yes, but I don't really see this as a problem.  I've seen tons of GM
scripts that use a cut-and-paste variant of my "how to use this
script" comment header, which leads me to believe that most people
writing user scripts are starting from an existing script and trimming
out stuff they don't need.  If popular early scripts that use
GM_xmlhttpRequest (or any other new feature added in the future) have
a check at the beginning like if (!GM_xmlhttpRequest), I suspect we'll
be seeing such code for years.

> I suppose API docs would be helpful.  :P

So would "Dive into Greasemonkey"...  Not that I'm promising anything, mind you.

-- 
Cheers,
-Mark


More information about the Greasemonkey mailing list