Generally speaking, you should not (as a web developer) be attempting to alter the browser functionality.
There are very few cases where this should be considered acceptable.
If you are interested in the javascript, a very quick Google search will tell you what you need to know.