Firebug Tip: Observe page redirects
by Honza- Published:July 5th, 2011
- Comments:5 Comments
- Category:Firebug, Firebug Tip, NetExport, Planet Mozilla
The Persist feature has been available in Firebug for some time already, but I recently got several questions indicating that it doesn't have the visibility it deserves. So, let's introduce it quickly.
Firebug UI resets every time the current browser tab is refreshed or navigated to another page - to show the new state. The consequence is that all Firebug panels trash the content (i.e. the Net or Console panel entries are lost).
This is fine since usually the user doesn't want to keep the entire history. But what in the case when you want to debug the transition process between page loads or redirects?
And this is exactly when the Persist button becomes practical...
See all Firebug tips
Console Panel
Let's see a simple example that shows how to utilize the Persist button when debugging onUnload event.
This is a script on our test page
<script type="application/javascript">
function onLoad() {
console.log("onLoad");
}
function onUnload() {
console.log("onUnload");
}
</script>
</body>
This is what the Console panel displays if you refresh the page (still the same even if you refresh several times):
The onUnload log is not displayed since immediately after the page is unloaded the Console panel is cleared - yep a new page is loaded.
And this is what you can see in the Console if you check the Persist button and refresh one more time.
The clear part is not happening now.
Net Panel
Let's use the same example page and see what the Persist button does in context of the Net panel.
Again, this is what the Net panel shows if you refresh the page:
And now with Persist mode enabled:
The previous entries (just one in this particular case) are kept under a special expandable entry at the top of the Net panel. You can refresh more times or even navigate to a different page and all the HTTP page load history is there.
Note, that the entire Net panel history (multiple page loads) can be exported using NetExport extension and displayed using HAR Viewer online tool (individual page loads are preserved and you can compare).
Do you think it would make sense to support the Persist feature on another panel too?
5 Comments
One related feature that would be useful, is a "Break on redirect" function or maybe some other way of logging the source of redirects. Re-directs can come from 3xx status codes, Meta headers, javascript window.location changes, etc., but it can be hard to track down where a re-direct originated from.
A message saying "history discarded because of redirects" would also give a clue that you missed something and may need to use the persist function. Thanks!
Recently I had noted that firebug dont show the regex content in the debugger, it show the phrase in green "RegExp", but I want to see the regex content!!
Why this feature has to be banned?
@jorge: create a new issue report here (+ a simple test case that I can use to see the problem): http://code.google.com/p/fbug/issues/list?start=1000
and I'll fix it.
boy thanks for the tip on the Persist button, that will save me a lot of frustration!! Thank you! 🙂
Great tip, will save me a lot of frustration with FF and Firebug too