# Abort loadSound()

**URL:** <https://discourse.processing.org/t/abort-loadsound/35377>\
**Category:** Coding Questions\
**Created:** [February 22, 2022, 10:02am UTC](https://discourse.processing.org/t/abort-loadsound/35377 "2022-02-22T10:02:20Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Lerudan](https://avatars.discourse-cdn.com/v4/letter/l/f14d63/32.png) [@Lerudan](https://discourse.processing.org/u/Lerudan)\
**Post date:** [February 22, 2022, 10:02am UTC](https://discourse.processing.org/t/abort-loadsound/35377/1 "2022-02-22T10:02:20Z")

</div>

I’m building a little applet with audio-files. Each level starts with loading an audiofile.  
I also use the history api of the browser, to give each level a usable URL.

Now if a user changes the history state, while loadSound is loading the sound, a second request is executed, and the feedback provided to the while\_loading callback of both those requests is competing, creating some very funky loading bar behaviour. Also the

Is there a way to abort loadSound() to stop this from happening?

I looked through the code, but I found no way of getting to the XMLHTTPRequest to use .abort().
