{"action":"created","issue":{"url":"https://api.github.com/repos/ariya/phantomjs/issues/14396","repository_url":"https://api.github.com/repos/ariya/phantomjs","labels_url":"https://api.github.com/repos/ariya/phantomjs/issues/14396/labels{/name}","comments_url":"https://api.github.com/repos/ariya/phantomjs/issues/14396/comments","events_url":"https://api.github.com/repos/ariya/phantomjs/issues/14396/events","html_url":"https://github.com/ariya/phantomjs/issues/14396","id":164353898,"number":14396,"title":"onbeforeunload callbacks do not allow network requests","user":{"login":"Gerg","id":875892,"avatar_url":"https://avatars.githubusercontent.com/u/875892?v=3","gravatar_id":"","url":"https://api.github.com/users/Gerg","html_url":"https://github.com/Gerg","followers_url":"https://api.github.com/users/Gerg/followers","following_url":"https://api.github.com/users/Gerg/following{/other_user}","gists_url":"https://api.github.com/users/Gerg/gists{/gist_id}","starred_url":"https://api.github.com/users/Gerg/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Gerg/subscriptions","organizations_url":"https://api.github.com/users/Gerg/orgs","repos_url":"https://api.github.com/users/Gerg/repos","events_url":"https://api.github.com/users/Gerg/events{/privacy}","received_events_url":"https://api.github.com/users/Gerg/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/ariya/phantomjs/labels/Need%20more%20information","name":"Need more information","color":"CC317C"}],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":7,"created_at":"2016-07-07T16:36:00Z","updated_at":"2016-07-09T20:29:57Z","closed_at":null,"body":"1. Which version of PhantomJS are you using? Tip: run `phantomjs --version`.\r\n\r\n > 2.1.1\r\n\r\n2. What steps will reproduce the problem?\r\n  1. Register a `beforeunload` callback containing a network request.\r\n  2. Load the page in phantom\r\n  3. Close the page\r\n  4. The callback triggers but the network request is not made\r\n\r\n Example: \r\n```js\r\nwindow.addEventListener('beforeunload', function () {\r\n   $.post('/foo', {});\r\n});\r\n```\r\n\r\n3. Which operating system are you using?\r\n\r\n> OSX\r\n\r\n4. Did you use binary PhantomJS or did you compile it from source?\r\n\r\n> Installed via homebrew\r\n\r\n5. Please provide any additional information below.\r\n\r\n> It works in Chrome/Firefox/Safari.\r\n"},"comment":{"url":"https://api.github.com/repos/ariya/phantomjs/issues/comments/231554327","html_url":"https://github.com/ariya/phantomjs/issues/14396#issuecomment-231554327","issue_url":"https://api.github.com/repos/ariya/phantomjs/issues/14396","id":231554327,"user":{"login":"Gerg","id":875892,"avatar_url":"https://avatars.githubusercontent.com/u/875892?v=3","gravatar_id":"","url":"https://api.github.com/users/Gerg","html_url":"https://github.com/Gerg","followers_url":"https://api.github.com/users/Gerg/followers","following_url":"https://api.github.com/users/Gerg/following{/other_user}","gists_url":"https://api.github.com/users/Gerg/gists{/gist_id}","starred_url":"https://api.github.com/users/Gerg/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Gerg/subscriptions","organizations_url":"https://api.github.com/users/Gerg/orgs","repos_url":"https://api.github.com/users/Gerg/repos","events_url":"https://api.github.com/users/Gerg/events{/privacy}","received_events_url":"https://api.github.com/users/Gerg/received_events","type":"User","site_admin":false},"created_at":"2016-07-09T20:29:57Z","updated_at":"2016-07-09T20:29:57Z","body":"@erikdubbelboer I too am using a node backend. I also noticed that Safari only made the request when closing the tab, but at the time I just assumed it was because the event was not firing on refresh.\r\n\r\n@Vitallium It's a real webpage. I tested Chrome/ Firefox manually and using webdriverio (where their behavior matched). I only tested phantom using webdriverio."}}
{"actor":{"display_login":"Gerg"}}