更新时间:2022-04-19 22:47:08
选中此链接 https://developer.chrome.com/extensions/contentSecurityPolicy 它说:
内联JavaScript不会执行。此限制禁止内联块和内联事件处理程序(例如button onclick =...)。
Inline JavaScript will not be executed. This restriction bans both inline blocks and inline event handlers (e.g. button onclick="...").
(click,capturePhoto)中的简单事件监听器,例如:
So you can use a simple event listener inside a script tag like:
document.getElementById("myBtn").addEventListener("click", capturePhoto);