Check if history functions are undefined

I ran into the issue in Awesomium that history.replaceState is undefined (obviously doesn't support it). There are a lot of other browsers than IE that don't support these history APIs. We should at least do a basic check to see if they are undefined before trying to call them. This fixes compatibility with older browsers.