[Greasemonkey] Ajax Question (Redirect URL)

mmccarthy at reifysoft.com mmccarthy at reifysoft.com
Thu Jun 30 18:11:12 EDT 2005


If it consistently does a redirect, you could do a HEAD instead of a GET to
get headers.  If it's a redirect, the status code should be something like
301 or 302.  If so, do a GET on the value of the Location field from the
response headers.  (Some servers hypothetically might not provide that field
even on a redirect, but I haven't had a problem with it.)
 
I haven't run into this in Firefox/GM before.  I did, however, run into it
when porting Book Burro to IE/Turnabout and still haven't fixed one case.
The URLs for both Buy.com and Half.com both gave redirects, and Firefox/GM
would follow them and return the desired page.  In IE/Turnabout with the
same script, it would follow the redirect for Buy.com, but not for Half.com.

http://www.buy.com/retail/GlobalSearchAction.asp?qu=0439784549
Firefox/GM XMLHTTPRequest: Follows two 302 redirects to get the desired
file.
IE/Turnabout XMLHTTPRequest: Follows two 302 redirects to get the desired
file.

http://search.half.ebay.com/0375760644
Firefox/GM XMLHTTPRequest: Follows two 302 redirects to get the desired
file.
IE/Turnabout XMLHTTPRequest: Gets a 302 redirect and doesn't follow it.

Really weird.

Matt McCarthy
When I am king, you will be first against the wall 
With your opinion, which is of no consequence at all. 
-Radiohead, "Paranoid Android" 


-----Original Message-----
From: greasemonkey-bounces at mozdev.org
[mailto:greasemonkey-bounces at mozdev.org] On Behalf Of Mark
Sent: Thursday, June 30, 2005 10:09 AM
To: greasemonkey at mozdev.org
Subject: [Greasemonkey] Ajax Question (Redirect URL)

I was wondering if anyone knows of a way to get a redirect URL from an
xmlhttprequest.

Example: When I go to http://website.com?param=x, it sends me to
http://website.com?answer=y. The "y" is based on what I put in as "x",
but when you make an xmlhttprequest to http://website.com?param=x,
there is no way of retrieving the redirected url.

Any ideas?
_______________________________________________
Greasemonkey mailing list
Greasemonkey at mozdev.org
http://mozdev.org/mailman/listinfo/greasemonkey




More information about the Greasemonkey mailing list