这是我当前的 manifest.json
文件:
{
"manifest_version": 2,
"name": "My App",
"description": "My App Description",
"author": "My Name",
"version": "1.0.0",
"app": {
"urls": [
"http://www.example.com"
],
"launch": {
"web_url": "http://www.example.com",
"container": "panel",
"height": 500,
"width": 500
}
},
"icons": {
"128": "app128.png"
},
"permissions": []
}
发生了什么:应用程序在带有系统边框的 500x500px
窗口中打开。
我需要什么:应用程序需要以 Chrome 风格的边框打开。 (与 Google Keep 应用相同,或者如果您没有 Google Keep 应用,请转至应用启动器 => 汉堡按钮 => 设置)
我需要在 manifest.json
文件中更改或添加哪些内容?谢谢!
我得到的内容与我需要的内容的屏幕截图:
最佳答案
尽管我对区分 hosted app 的细微差别一无所知,一个Chrome App ,以及 packaged app ,我怀疑您的“托管”应用程序使用其“主机”操作系统的系统边框,并且重写为“Chrome”应用程序将为您提供与 Google Keep 相同的 Chrome 风格边框。
请尝试这个重写;我很好奇它是否有效:(你必须使用 <webview>
)
manifest.json
{
// name, description, manifest_version, etc
// NOT "launch"
"app": { "background": { "scripts": ["main.js"] } },
"permissions": ["webview"]
}
main.js
chrome.app.runtime.onLaunched.addListener(function() {
chrome.app.window.create("webview-embedder.html");
});
webview-embedder.html
<!DOCTYPE html>
...
<body><webview src="http://www.example.com"></webview></body>
</html>
如果这有效的话我会非常兴奋:-p。
关于google-chrome - 使 Chrome 应用程序以特殊窗口边框运行,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/24517089/