{"action":"created","issue":{"url":"https://api.github.com/repos/visionmedia/page.js/issues/318","repository_url":"https://api.github.com/repos/visionmedia/page.js","labels_url":"https://api.github.com/repos/visionmedia/page.js/issues/318/labels{/name}","comments_url":"https://api.github.com/repos/visionmedia/page.js/issues/318/comments","events_url":"https://api.github.com/repos/visionmedia/page.js/issues/318/events","html_url":"https://github.com/visionmedia/page.js/issues/318","id":109057480,"number":318,"title":"How to handle browser back/forward button?","user":{"login":"amitava82","id":1279530,"avatar_url":"https://avatars.githubusercontent.com/u/1279530?v=3","gravatar_id":"","url":"https://api.github.com/users/amitava82","html_url":"https://github.com/amitava82","followers_url":"https://api.github.com/users/amitava82/followers","following_url":"https://api.github.com/users/amitava82/following{/other_user}","gists_url":"https://api.github.com/users/amitava82/gists{/gist_id}","starred_url":"https://api.github.com/users/amitava82/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/amitava82/subscriptions","organizations_url":"https://api.github.com/users/amitava82/orgs","repos_url":"https://api.github.com/users/amitava82/repos","events_url":"https://api.github.com/users/amitava82/events{/privacy}","received_events_url":"https://api.github.com/users/amitava82/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":1,"created_at":"2015-09-30T10:22:56Z","updated_at":"2016-04-05T07:36:24Z","closed_at":null,"body":"Similar to document unload, I want to prompt user before navigation and either continue or cancel based on user input. I tired middleware function (do not invoke next() if user want to prevent navigation) however, url remains changed."},"comment":{"url":"https://api.github.com/repos/visionmedia/page.js/issues/comments/205702096","html_url":"https://github.com/visionmedia/page.js/issues/318#issuecomment-205702096","issue_url":"https://api.github.com/repos/visionmedia/page.js/issues/318","id":205702096,"user":{"login":"timaschew","id":110870,"avatar_url":"https://avatars.githubusercontent.com/u/110870?v=3","gravatar_id":"","url":"https://api.github.com/users/timaschew","html_url":"https://github.com/timaschew","followers_url":"https://api.github.com/users/timaschew/followers","following_url":"https://api.github.com/users/timaschew/following{/other_user}","gists_url":"https://api.github.com/users/timaschew/gists{/gist_id}","starred_url":"https://api.github.com/users/timaschew/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/timaschew/subscriptions","organizations_url":"https://api.github.com/users/timaschew/orgs","repos_url":"https://api.github.com/users/timaschew/repos","events_url":"https://api.github.com/users/timaschew/events{/privacy}","received_events_url":"https://api.github.com/users/timaschew/received_events","type":"User","site_admin":false},"created_at":"2016-04-05T07:36:24Z","updated_at":"2016-04-05T07:36:24Z","body":"What for me worked is this:\r\n\r\n```js\r\nwindow.onpopstate = function(e) {\r\n  page.replace(e.state.path)\r\n}\r\n```"}}