There’s some weirdness with the GM_xmlhttpRequest and the HEAD method.
In the first place, the readychangestate
event seems not to fire in a reliable way, but this is more or less a known bug (diveinto greasemonkey).
On the other hand, there appears to be just one and only one callback for the HEAD method, so no urgent need to check the readystate value.
The other weirdness is that sometimes the onload handler doesn’t get called, while the onerror handler fires with a perfectly legal result (e.g. status 200 OK
).
Observations
There seems to be not much of a pattern in which sites do trigger the onerror or onload events. The behavior seems consistent for each request though. With a couple of tests, http://www.yahoo.com consistently triggered the onerror, while a couple of other sites just worked fine.
Work around
My work around for the time being is:
- Avoid checking readystate altogether
- Duplicate the callback function for both
onload
and onerror