And hell froze over...

Is the unusual snow before Christmas here in England a sign that the end is nigh? It may be possible as I’ve come across something that Internet Explorer does better than any other web browser. Actually that’s not quite true, it’s actually a feature which no other browser has and which I think is a really good idea and would be useful if all browsers supported – the Javascript onbeforeprint and onafterprint events (more info at

The reason this functionality could be useful came up in the development of a client site recently (, where the site is one long html page, with each logical ‘page’ a section which is scrolled to vertically, either from the user manipulating the browser scrollbar, the arrow keys (which are captured in Javascript), the main navigation or pagination links in each section.

The idea of very tall pages seems to be quite popular at the moment – two high profile uses of the design idea which come to mind being the Atlantis version of the ‘Lost Worlds Fairs’ IE9/WOFF demo site, and the awesome Ben the Bodyguard.

The problem I encountered on the Fusion Business Solutions site comes when a user wishes to print one of the ‘pages’ – because it’s all one physical HTML page, they would end up printing all the ‘pages’, rather than just the one they specifically wanted. Now on this site it’s not a huge deal, but if we had the onbeforeprint and onafterprint events available in all browsers, we could use the onbeforeprint event to hide all the other pages (i.e. other than the currently active one – and we know which one is active from other scripting used to control the navigation functions) before the page is sent to the print queue and then use the onafterprint event to unhide them all again.

Written by , Saturday 18th December 2010


There are no comments

Posting comments after three months has been disabled.