how not to let console.log() to cause error on IE or other browsers - SitePoint Forums

if (typeof console == "undefined" || typeof console.log == "undefined") var console = { log: function() {} };

This is a fix for Firebug's console.log statements causing js execution problems in other browser. The above code has to be pasted at the top of javascript statements on your page or before the usage of the first console.log statement

Posted
 

How to make a footer stick to the bottom of a webpage

Often you face a situation where you don't have enough content on the webpage to make use of the space available in the browser window. A good example, for this is the "404 - File not found" page on your site.

I use the following technique to get rid of the situation where the footer doesn't stick to the bottom of the page. The idea is simple - Measure the height of the content and compare it with your window height. If the content height is less than the window height, then fill the difference with an empty space or to say exactly, add a div with the height set to the difference.

The code below uses jquery javascript library and should work pretty much in every browser.

Enjoy !!

Update:

I have updated the code above, to make sure that the footer sticks to the bottom on window resize events. Now when you are using FireBug, to should notice the footer moving up and down and window resize events. This is especially useful if you have a large monitor.

Posted
 

Includes in Javascript

Ever wondered how to include other javascript files in javascript, here is how you can do it.

You can ask me when this could be useful. You can use it when you want to conditionally include javascript and css files. Lets say on the admin part of the site you want to use a different stylesheet, then you can parse the url and include the stylesheet, given certain parameters or if the url matches a regular expression.

Posted