Cool - View Selection Source
Have you ever been interested in viewing just part of the source code that created a Web page? Perhaps there's one section of the page that you're curious about. Instead of viewing the entire HTML source, highlight the text of the area you are interested in, right-click (control-click on Mac) and then select "View Selection Source."

Not Cool - View Source Hits Server
Every time you view source in Firefox - whether using Firefox's built-in controls or alternate controls like those included in the Web Developer add-on - the view source window makes an additional server request to ensure you are not viewing source from your cache. While this initially may sound like a good thing it absolutely sucks if you are attempting to view source behind a certain session-enabled applications such as an intranet. This is the case for me at work. When I view source in our intranet Firefox makes an additional trip to the server where our session-management code sees the Firefox source window as a new session and shows the code prompting me to log-in again. To get around this feature I searched Firefox's add-ons and found the View Source Chart add-on. Not only does this get around the issue but it also produces a more readable document complete with color-coding and collapsible sections. Note, this add-on does not fix the problem if you are working in a frames environment. If you are interested in reading more about this add-on check out the authors Web site.

Cool - Refresh View Source Window
Another cool feature about viewing source is you can refresh the code, and hit the server again just like you would a normal Web page. Just hit control-R (command-R on Mac). This is pretty handy if you are making some code changes and you need to view the source to check your work.

Aaron West's Gravatar
About this post:

This entry was posted by Aaron West on December 6, 2006 at 7:32 AM. It was filed in the following categories: ColdFusion, General. It has been viewed 24563 times and has 14 comments.

14 Responses to Cool and Not So Cool Features of Firefox

  1. > right-click (control-click on Mac) and then select "View Selection Source."
    Good tip! Does anyone know if its possible to open 'View Source' in a new tab rather than a new window?

  2. the regular "view page source" in the right click contextual menu does not hit the server again...

  3. Felix, I have not found a way for the built-in "View Source" option to open in a new tab rather than a new window. However, if you install the "View Source Chart" add-on I mentioned above, it has a preference for opening in a new tab. Install the add-on and then open Tools | Add-ons and go to the preferences for "View Source Chart" and you can turn this feature on.

    Critter, what version of Firefox are you using. Firefox 2, on PC and Mac, definitely hits the server before showing source for me. It does it when viewing any Web site (non-framed as well as framed).

  4. Anne Ahnamhis

    We've noticed another issue with the View Selection Source option in that it rewrites bad code, adding SPAN tags as necessary and even converting an xhtml friendly BR (with slash to close itself) to the old-school non-closed version.

    A handy extension but not so great for troubleshooting code.

  5. You should really be using the Web Developers Toolbar and it's View Generated Source. It shows you exactly what the browser generated, so you can see DOM objects that javascript may have changed or anything else in the browser window.

    Besides, how can you NOT love almost all of the other 60 brazillion features on this extension?

  6. I mentioned the Web Developer extension in my post and I really like it. However, it does not defeat Firefox's additional trip to the server when viewing source.

  7. 'View Generated Source'
    I could not see another request happen with this (I say the request fly by on peerguardian when a regulare view source occured), and an F5 won't update the source view like it will on the regular. I could be totally wrong though...

  8. Um. Typing and eating is not my specialty...

    'View Generated Source'
    I could not see another request happen with this (I can see the request fly by on peer guardian when a regular view source occurred), and an F5 won't update the source view like it will on the regular view source. I could be totally wrong though...

    The creator says that View Generated Source comes straight from the browser. I've looked into this before too.

  9. Rafael

    View Generated Source does show the niceties of javascript generated code, but it does the View Selection Source thing of turning XHTML closing tags in <img> and <br> into HTML4 tags without the slash.

  10. Ctrl-A, right click, view selection source. Not sure how reliable it is, but this trick will view the page source without re-requesting from the server. Even on a page with POSTed information.

  11. To clarify, if you "View Source" in Firefox (there's several ways to do this in the right-click menu and the View pull-down menu) it will display the generated source code and NOT ping the server again.

    That said, if you have the Web Developer's Toolbar installed and you have it set to disable cache, Firefox will be forced to hit the server again every time you view source using Firefox's methods. If you use the View Generated Source option of the Web Developer's Toolbar with the Disable Cache feature turned on, Firefox will NOT hit the server again in order to show you the source code. I hope that clears this up.

  12. DiShi

    Aaron, You are absolutely correct. I had the same problem. I have WDT & ITs Disable Cache as checked. So whenever i "View Source", it goes to server to get the latest copy of page.

    Thanks a lot for help.

  13. Right on DiShi, glad you found this to be helpful.

  14. My personal opinion is that Firefox is a great browser and their addons are really nice. I do not use that much view source addons as I use colorzilla, css validator, JS validator, source chart and similar nice things. And I get them all for free and all help me alot. That is what I consider really useful and that's why I appreciate this browser more than others and this is why I am using it.

    My 2 cents.

    Kind regards,