Firefox 3 GM_xmlhttprequest redirect problem

66 views
Skip to first unread message

Jacky

unread,
Apr 28, 2008, 9:59:49 AM4/28/08
to greasemonkey-users
Hi, I'm using GM 0.7.20080121.0.

In FF2.0.0.14, when a GM_xmlhttprequest fired and receive a 301/302
response, it seems that FF would try to resolve to a correct url.

But in FF3b5, when a GM_xmlhttprequest fired, it would receive 301/302
directly at the onload function.

For the time being, I have modified the script to something like:

GM_xmlhttprequest({
method:"GET",
url: url,
onload: function(response){
if(response.status == 302 || response.status == 303){ //moved
var loc = /Location: ([^\n]*)
\n/.exec(response.responseHeaders)[1];
GM_xmlhttprequest({method:"GET", url:loc,
onload:arguments.callee})
}
}
})

I just don't know whether it's the responsibility the script or
browser to resolve the redirection?

esquifit

unread,
May 4, 2008, 7:16:34 AM5/4/08
to greasemon...@googlegroups.com
Confirmed. All scripts relying on automatic redirection are now
broken in Firefox 3, at least in GM 0.7.20080121.0. I've already
found this in the "RSS Panel X" [1].

(Actually I find this extremely useful. An obvious application is to
resolve shortened urls à la tinyurl without the need of an extra
request, besides the fact that probably not all among the several
similar services offer a preview feature [2] like Tinyurl which can be
used to find the destination url before actually loading the page).

In order to ensure backwards compatibility it would be better to have
an extra boolean attribute, say 'follow_redirects', in the argument
to GM_xmlhttpRequest which would default to 'false'. Is this
feasible?

[1] http://userscripts.org/scripts/show/6073
[2] http://tinyurl.com/preview.php

esquifit

unread,
May 6, 2008, 4:58:57 PM5/6/08
to greasemon...@googlegroups.com
Reply all
Reply to author
Forward
0 new messages