Exception when accessing history.state in IE 10

Accessing history.state sometimes raises an exception in IE10, instead of returning null.
This fix surrounds accesses to history.state with try / catch blocks.