while page loading:
var x = new XMLHttpRequest();
x.open("GET", "some-url", true);
x.onabort = function () {
// abort should be called!
};
x.send();
window.stop();
see https://developer.mozilla.org/en-US/docs/Web/API/window.stop and
http://xhr.spec.whatwg.org/#infrastructure-for-the-send()-method