我试图使chrome扩展是在全屏,但最大的我可以做的是一半的宽度。然后,它只是给予我一个滚动条在底部..我怎么才能使它在全屏?意思是,整个宽度的chrome浏览器?谢谢!
hivapdat1#
chrome.windows.update(windowId, { state: "fullscreen" })
请访问https://developer.chrome.com/docs/extensions/reference/windows/#method-update
jdzmm42g2#
在您的扩展“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(); }); });
13z8s7eq3#
你试过fullScreen API吗?
qxsslcnc4#
addEventListener("click", function() { var el = document.documentElement , rfs = el.requestFullScreen || el.webkitRequestFullScreen || el.mozRequestFullScreen ; rfs.call(el); });
如post所示
z18hc3ub5#
用于所有浏览器(包括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');} });
5条答案
按热度按时间hivapdat1#
请访问https://developer.chrome.com/docs/extensions/reference/windows/#method-update
jdzmm42g2#
在您的扩展“background.js”脚本中:
13z8s7eq3#
你试过fullScreen API吗?
qxsslcnc4#
如post所示
z18hc3ub5#
用于所有浏览器(包括msRequestFullscreen)中网页上的常规用途