【发布时间】:2011-09-12 16:59:10
【问题描述】:
我一直在查看 Chrome 扩展程序,我想创建一个使用侧边栏与网页交互的扩展程序。因此,用户单击按钮启动扩展程序,当前页面拆分,右侧部分显示我的扩展程序。我在下面尝试过,但我什么也没看到(工作或其他)。我对它不起作用并不感到惊讶,因为我没有一个 sidebar.html 文件来做一件事。我在清单中有它的原因是因为我在本网站的另一篇文章中看到了它。建议在 manifest.json 中使用“sidebar”行,但文档中甚至没有提到“sidebar”是清单语法的有效部分。
manifest.json:
{
"name": "Test 1",
"version": "1.0",
"description": "Test Extension 1",
"page_action": {
"default_icon": "icon.png",
"default_title": "Testing",
"default_popup": "popup.html"
},
"sidebar" : {},
"permissions": [
"experimental"
]
}
popup.html:
<script>
chrome.experimental.sidebar.show();
chrome.experimental.sidebar.expand();
chrome.experimental.sidebar.navigate({path: "sidebar.html"});
</script>
我已启用“实验性”。
感谢您的帮助。
【问题讨论】:
-
那你为什么没有
sidebar.html? -
请注意,侧边栏 API 将在 Chrome 的未来版本中消失。这些是最前沿的文档(注意 URL 中的
trunk):code.google.com/chrome/extensions/trunk/experimental.html