View Source improvements in IE8

March 27, 2009 at 10:38 PMBen

Compared to Firefox and Chrome, IE has always had a very plain rendering when viewing the source of an HTML page.  The source just shows up as plain text in Notepad.  HTML is of course just plain text, but Firefox and Chrome add coloring for matching HTML tags which makes looking at the source a little more pleasant.

IE8 now does what these others browsers have been doing.  The HTML source no longer is displayed in Notepad, but in an IE source viewing pop-up window.  This IE source viewer now does tag coloring and even includes line numbers.  This is a nice little improvement.

IE8 Source Viewer

I did notice one other interesting feature when doing a View Source in IE8.  On the File menu of the source viewer, if you select 'Save', you have a choice to save the HTML Source (nothing special here) or save the 'Formatted HTML View' (screenshot below).  This "save formatted HTML view" will create an HTML file of how IE8's source viewer is displaying the source -- including the tag coloring.  You can then open up that saved HTML file in any browser to have the source display exactly as it does in IE8's source viewer.

IE8 Source Viewer - Save as Formatted HTML View

The file size of the "formatted html view" is considerably larger than the size of the plain HTML source without the formatting.  For instance, for a particular 45 KB HTML page I tried this in, the formatted html view file is 452 KB.

I'm guessing the new color tags and syntax highlighting in the new source viewer was done via HTML markup.  So it probably wasn't a big deal for the IE team to just include this new save as 'Formatted HTML View' option -- since the formatted HTML source was already there.  In any event, it's nice it's there for whenever the need of the formatted html source could be used.

Posted in: General

Tags: , ,

Null Url Referrer going from HTTPS to HTTP

February 25, 2009 at 5:10 PMBen

Thought I would pass on a small issue I ran into recently when redirecting a user from an HTTPS page to an HTTP page.  When the person reached the HTTP page, Request.UrlReferrer was null.  There are browsers, add-ons, proxies, security suites and other entities that will strip the url referrer sent to a web server, but that was not the case in this instance as this was happening to me when testing a new site and didn't happen when I was redirected to the same page from an HTTP page.

It turned out this is a pretty standard security feature implemented by browsers to omit the referrer when a user is redirected from an HTTPS page to an HTTP page, or when a user clicks on a hyperlink taking them from an HTTPS page to an HTTP page.

This behavior does make sense considering sensitive information may be stored in query string parameters of the HTTPS page url.  I found this MS KB article explaining this behavior.  In the article, MS suggests some sites may even store credit card data in a url.  Credit card numbers in a url ... really??  I was thinking more along the lines of private session ids in the url.  I don't think I'd feel too comfortable shopping at a site if I saw my credit card number in the address bar ;-)

Posted in: Development

Tags: , ,

The Ctrl-Z of Browsers

February 21, 2009 at 9:04 PMBen

In today's tabbed browsing world, maybe you find yourself opening and closing tabs left and right.  If you're into the keyboard shortcuts, that would be Ctrl-T and Ctrl-W respectively   What if you accidentally close a tab?  This happens to me most often when either I thought I was done with the website I was on, or I thought the tab I was on was a new tab with nothing to go 'back' to.

Fortunately, the good browsers out there offer a Ctrl-Shift-T keyboard command to open up the last tab you closed.  I like to think of it as the "ctrl-z of browsers".  This keyboard command is very handy because you can actually keep pressing Ctrl-Shift-T to open up all the tabs you previously closed.  Each tab you re-open not only opens up with the page you were on when the tab was closed, but the browser history for that tab is also preserved.  So once you re-open a closed tab, the entire 'Back' button browser history is there.

Ctrl-Shift-T works in Firefox and Chrome.  It doesn't appear to work in Safari/Windows and doesn't work in IE7.  That's what I meant by this keyboard shortcut working in 'good' browsers   It does appear to work in IE8.

Since discovering this keyboard command it's something I use probably at least once a day.  Sometimes many times a day!