http://qs321.pair.com?node_id=516864


in reply to Is it possible to get the redirected URL?

LWP (or WWW::Mechanize) would let you load Page B and automatically follow the HTTP redirects, with the final URL being available to you in the uri method.

Where things get tricky is if any of the pages handle redirects via meta refresh or JavaScript.

The former is pretty easy to code around, but the latter usually requires prior knowledge of what the JavaScript is/does so that you can explictly tailor your code to handle it (and then hope no one changes it).

If you do expect a lot of JavaScript redirects, a better alternative might be to use either Win32::IE::Mechanize or Mozilla::Mechanize, as both browsers have JavaScript engines and should be able to follow those redirects automatically (but I've used neither module, so can't confirm this).

    --k.