D
D
dfhkjhg2020-04-28 02:17:29
JavaScript
dfhkjhg, 2020-04-28 02:17:29

Why doesn't audio work in the browser extension?

There is a line (browser extension code) alert.mp3 is located in the folder where and the file with the code when I load the site gives an error GET https://site.com/alert.mp3 404 How to fix it (why alert.mp3 turns into a link )
const audio = new Audio('alert.mp3')

Answer the question

In order to leave comments, you need to log in

1 answer(s)
I
Igor, 2020-04-28
@dfhkjhg

try like this

const audio = new Audio(chrome.runtime.getURL('alert.mp3'))

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question