9

I am trying to make chrome extension to be in full screen, but the max I can do is half width. More then that it just give me a scroll bar in the bottom.. How can I make it to be in full screen? meaning, the whole width of the chrome browser? Thanks!

EliK
  • 157
  • 1
  • 2
  • 4
  • 1
    You're talking about a Browser Action popup window? I'm not sure those are able to be full-width windows. Try the Fullscreen API, but even that might not be possible. You may want to open a new tab with your extension's content instead. – Jason Hall Jun 26 '12 at 15:27
  • You should accept Vincent Scheib's answer at the bottom. It is the correct, current, and "fully operational" answer. – temporary_user_name Sep 24 '13 at 04:53

5 Answers5

13
chrome.windows.update(windowId, { state: "fullscreen" })

See https://developer.chrome.com/docs/extensions/reference/windows/#method-update

2Toad
  • 14,799
  • 7
  • 42
  • 42
Vincent Scheib
  • 17,142
  • 9
  • 61
  • 77
  • 2
    But when you exit the full screen, your browser will not back to the state you entered before, how to solve that ?? – Tarek Oct 16 '13 at 23:17
  • 1
    What if I want it to be fullscreen on another display? –  Dec 01 '16 at 15:56
3

In your extensions "background.js" script:

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();
    });
});
Andrew Mackenzie
  • 5,477
  • 5
  • 48
  • 70
  • It requires 'app.window' permission, but: "'app.window' is only allowed for packaged apps, and this is a extension." – danieleds Sep 10 '13 at 19:28
1

Did you try the fullScreen API ?

Calvein
  • 2,111
  • 13
  • 28
1
addEventListener("click", function() {
    var
          el = document.documentElement
        , rfs =
               el.requestFullScreen
            || el.webkitRequestFullScreen
            || el.mozRequestFullScreen
    ;
    rfs.call(el);
});

As seen in this post

Community
  • 1
  • 1
John Riselvato
  • 12,854
  • 5
  • 62
  • 89
0

for general use on web pages in all browsers, include 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');}
});
Rob Parsons
  • 839
  • 6
  • 4