Reputation: 1511
My website makes a lot of requests. I often need to cancel all current requests, so that the browser is not blocking relevant new requests.
I have 3 kinds of requests:
For Ajax its no problem as the XMLHttpRequest object supports canceling. What I need is a way to make any browser stop loading resources, from DOM-Objects.
Looks like simply removing an object (eg. an image-tag) from the DOM only helps avoiding an request, if the request is not already running.
UPDATE: a way to cancel all requests, which are irrelevant, instead of really any request would be perfect.
Upvotes: 24
Views: 20832
Reputation: 1147
window.stop()
should cancel any pending image or script requests.
Upvotes: 57
Reputation: 32533
I think document.close()
stops all requests, but I'm not so sure about it.
Upvotes: 2