manifest.json
{ "name": "fullscreen app", "description": "This app starts up in fullscreen mode.", "version": "0.1", "app": { "background": { "scripts": ["background.js"] } }, "icons": { "128": "128.png" }, "permissions": [ "fullscreen" ] }
main.html
<!DOCTYPE html> <html> <head> </head> <body> <p>Hello World!</p> <script src="main.js"></script> </body> </html>
background.js
chrome.app.runtime.onLaunched.addListener(function() { chrome.app.window.create('main.html', { 'bounds': { 'width': 400, 'height': 500 } }); });
main.js
// fullscreen the current window at startup. chrome.app.window.current().fullscreen();
ポイントは2つ
1) manifest.json の permissions に "fullscreen"
2) content script で chrome.app.window.current().fullscreen();
0 件のコメント:
コメントを投稿