实际上,我在工作时创建了一个扩展程序,以便在出现新票证时播放声音。 但是我对js和html的了解有限,但是如果您能帮助我。
出现的新行是这样的:
我可以检测到新的ID并播放声音吗?
{
"manifest_version": 2,
"name": "Test audio extension",
"description": "Test playing audio from an extension.",
"version": "0",
"author": "test",
"icons": {
"64": "images/icons/64.png",
"128": "images/icons/128.png"
},
"web_accessible_resources": [
"note.mp3"
],
"content_scripts": [
{
"matches": ["https://website/*"],
"js": ["cont.js"]
}
]
}
alert("Cliquez partout.")
document.addEventListener('click', () => {
let url = chrome.runtime.getURL('note.mp3')
console.log(url)
let a = new Audio(url)
a.play()
})