howler.js: Error when trying to develop locally
I get the following error when trying to use howler.js locally without a webserver:
XMLHttpRequest cannot load file:///C:/Users/Scott/WebstormProjects/guess_the_number/bird.wav. Cross origin requests are only supported for HTTP. howler.min.js:10
Uncaught Error: NETWORK_ERR: XMLHttpRequest Exception 101
I know the issue… that I need to use an http URL isntead of file:///. So that means I need a local webserver to develop on. However, I don’t want to do that for several reasons. For one, I don’t get the live editing feature that WebStorm provides. I’m also trying to teach kids JavaScript with howler.js. I don’t want to teach them about webservers at this point yet. Anyway, is there a way to use howler.js without using a webserver?
I know the HTML5 <audio> element can use file URLs. Can I force howler.js to fallback to this method for local files?
About this issue
- Original URL
- State: closed
- Created 11 years ago
- Comments: 20 (7 by maintainers)
The html5 option set to true fixed the CORS issues in my case (web app). const sound = new howler.Howl({ src, html5: true }); Found this here: https://github.com/goldfire/howler.js/issues/64