cs_*_*ndt 5 javascript google-chrome google-chrome-extension google-chrome-devtools
此问题始于Google Chrome的第23版.我的Chrome应用会打开一个标签,以便在启动的事件触发时显示其UI.
chrome.app.runtime.onLaunched.addListener(function()
{
chrome.tabs.create(
{
url: "../../index.html"
});
});
Run Code Online (Sandbox Code Playgroud)
此方案在Google Chrome第23版之前有效.现在运行我的应用程序时收到以下异常.
Error in event handler for 'app.runtime.onLaunched': Cannot call method 'create' of undefined TypeError: Cannot call method 'create' of undefined
Run Code Online (Sandbox Code Playgroud)
在检查chrome开发人员工具中的对象后,我注意到这chrome.tabs是未定义的.
我知道我不必在manifest.json中明确设置"tabs"权限,因为根据http://developer.chrome.com/extensions/tabs.html,创建,更新和删除方法不需要"标签" "许可.
在尝试向manifest.json文件显式添加"tabs"权限后,我会在chrome:// chrome/extensions /上为应用程序收到此消息.
There were warnings when trying to install this extension: 'tabs' is only allowed for extensions and legacy packaged apps, and this is a packaged app.
Run Code Online (Sandbox Code Playgroud)
如果我按照https://developers.google.com/chrome/web-store/docs/choosing给出的图表进行操作,并选择了一个打包的应用,因为我的应用的用户界面不小,我不打算扩展Chrome的用户界面和我无法使用chrome.tabs那么如何在新的或现有的选项卡内打开我的应用程序的UI,而不必创建一个弹出窗口(这是非常烦人的,不是用户友好的)?
| 归档时间: |
|
| 查看次数: |
3584 次 |
| 最近记录: |