Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

how to locate a redirect url while the request server response a 302 redirect code?

New Here ,
Jan 11, 2013 Jan 11, 2013

hi, guys

I am unable to locate a redirect url while the request server response a 302 redirect code.

var url:String = "http://a.com/"; (response a 302 code and redirect to http://b.vom/)

var req:URLRequest = new URLRequest(url);

var dispatcher:URLLoader = new URLLoader(req);

dispatcher.addEventListener(Event.COMPLETE, handlefunction);

dispatcher.addEventListener(HTTPStatusEvent.HTTP_STATUS, httpStatusHandler);

function handlefunction(event:Event):void

{

     trace(req.url);

     // the console outputs  "http://a.com/"

     // it should be "http://b.com/"

     // but the event.currentTarget.data is ok .    e.g.  ok.htm

}

function httpStatusHandler(event:HTTPStatusEvent):void

{

          

     trace("httpStatusHandler: " + event);

     //the console outputs:  httpStatusHandler: [HTTPStatusEvent type="httpStatus" bubbles=false cancelable=false eventPhase=2 status=200 responseURL=null]

     //responseURL is null

}

there some relative links in the data ,so I must get the redirect url .

I  got  404 from http://a.com/ok.htm , but i want http://b.com/ok.htm

thanks.

TOPICS
ActionScript
1.1K
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Jan 11, 2013 Jan 11, 2013
LATEST

Default value of followRedirects is true. If you want to handle them yourself, set it to false, get the code and make sure to continue the new request with the data provided:

http://help.adobe.com/en_US/FlashPlatform/reference/actionscript/3/flash/net/URLRequest.html#followR...

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines