Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

In Firebug, how can I stop a redirect? I want to examine and edit a webpage before it redirects. Under the Net tab, using Persist I can see all the GET including the previous pages and the redirect page, but I am still taken to the final redirect page. I want to stop one move before this. Is it possible?

EDIT: It is a JavaScript based redirect, but I need the rest of the JavaScript working, so blocking all JavaScript from execution is not a solution in this instance.

share|improve this question

1 Answer 1

What kind of redirect? There are Firefox addons outside of Firebug you can use to stop redirects. Firebug does not seem to provide this functionality itself.

Redirects based on the HTML "Meta refresh" (also HTTP "Refresh") can be blocked by setting accessibility.blockautorefresh to true in about:config. In fact, this corresponds to the "Warn me when web sites try to redirect or reload the page" option in Options > Advanced > General. Alternatively, addons such as RefreshBlocker can be used.

For JavaScript based redirects, JS can be completely disabled or addons such as NoScript can be used.

There generally isn't much you can inspect on a page that is redirected using HTTP 3xx response codes. In case anyone wants to know, setting network.http.redirection-limit to 0 in about:config causes all of these to show a Firefox error page.


JS redirects

JS-based redirects are difficult. I'm not aware of a method to stop them from within the browser. However, you can intercept the responses with a debugging proxy like Fiddler2, and replace it with your own modified response (the AutoResponder in Fiddler2 is one way). In this modified response, you'd want to remove any references to window.location and location, the usual ways to change the page from JS [you might be able to get away with replacing them with a dummy variable, e.g. var thisIsAMadeUpVarName]. That way, the redirect would never get to the browser. See the "Search and replace in HTML." section of this document (you may wish to also filter JS files if they are served separately).

share|improve this answer
    
It was a JavaScript based redirect, but I needed the rest of the JavaScript working. I'll add this to my question. –  Xonatron Feb 10 '12 at 14:46
    
@Matthew Doucette Unfortunately, that may not be possible in Firefox: superuser.com/questions/353339/… Mozillazine forums and my own testing say CAPS (selectively disabling JS function) won't work with window.location. Perhaps there is another method. –  Bob Feb 10 '12 at 15:46
    
@MatthewDoucette You can intercept the response with a debugging proxy to remove the redirects before they get there. I've updated my answer to add that. (a bit late, but... yea) –  Bob May 6 at 7:58

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.