geo*_*off 5 javascript google-chrome-extension
自Chrome 40以来,Chrome扩展程序的选项页面已具有第2版。我尝试创建一个带有一个简单按钮的选项V2页面alert:
js
function resetAll() {
alert("Not yet implemented.");
}
document.getElementById("reset-button").onclick = resetAll;
Run Code Online (Sandbox Code Playgroud)
html
<button id="reset-button">Reset All</button>
Run Code Online (Sandbox Code Playgroud)
当我单击选项页面中的按钮时,什么也没有发生。我什至拉起了Javascript调试器,看看我的代码是否真正在运行。确实如此,但是没有任何警报出现。
如果我使用的是Chrome扩展程序的较早的选项页面格式,则警报会毫无问题地显示。
有没有办法alert用OptionsV2 创建浏览器本机?
小智 6
chrome.extension.getBackgroundPage().alert('Are you sure you want to delete X?');
chrome.extension.getBackgroundPage().confirm('Are you sure you want to delete X?')
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
831 次 |
| 最近记录: |