Chrome support fixes

a safeguard for whether state is defined, const is not supported in strict mode. And onpopstate requires window prefix, according to spec.