[英]How to make chrome extension to be in full screen?
我正在嘗試將chrome擴展程序設置為全屏,但我能做的最大值是半寬。 更多的是它只是給我一個底部的滾動條..我怎么能讓它全屏? 意思是,Chrome瀏覽器的整個寬度? 謝謝!
chrome.windows.update(windowId, { state: "fullscreen" })
請參閱http://developer.chrome.com/extensions/windows.html#method-update
在你的擴展“background.js”腳本中:
chrome.app.runtime.onLaunched.addListener(function (launchData) {
chrome.app.window.create(
// Url
'/editor.html',
// CreateWindowOptions
{
'width': 400,
'height': 500
},
// Callback
function(win) {
win.contentWindow.launchData = launchData;
win.maximize();
win.show();
});
});
您是否嘗試過fullScreen API ?
addEventListener("click", function() {
var
el = document.documentElement
, rfs =
el.requestFullScreen
|| el.webkitRequestFullScreen
|| el.mozRequestFullScreen
;
rfs.call(el);
});
正如這篇文章所見
在所有瀏覽器的網頁上一般使用,包括msRequestFullscreen
addEventListener("click", function () {
var
el = document.documentElement
, rfs =
el.requestFullScreen
|| el.webkitRequestFullScreen
|| el.mozRequestFullScreen
|| el.msRequestFullscreen
;
if (rfs) { rfs.call(el); } else { console.log('fullscreen api not supported');}
});
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.