I have a system where I inject a script tag into the dom.
The browser tries to load the script url, which is actually a long-post to a Tornado server.
I’m trying to implement an “abort” feature, where I stop the long poll. I need to do this because I am long-polling multiple different URL’s which eventually exhausts the browser’s socket pool for my server.
I have tried removing the specific script node from the DOM, but the browser is stubborn and continues waiting for a response from the server.
Is it possible to tell the browser to stop trying to load a resource (specifically a javascript file) once I’ve included it into the DOM?
You could try an asynchoronous abort “mission” and kill the pid of the request. Thsi kind of tehnique is very similar to this post Cancel PHP script with XHR? so you could run an extra ajax call for an abort which handles it like in the post above. Happy new year!