Only trigger onpopstate event if it's triggered explicitly

When the document is loaded, onpopstate might be triggered, but `event.state` is `null` then.
When triggered by the browser arrows, it is not.