Fix bugs with browsers compatibility using history API.
Fix code style.