How to make chrome extension to be in full screen?

前端 未结 5 1528
盖世英雄少女心
盖世英雄少女心 2021-01-06 03:48

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

相关标签:
5条回答
  • 2021-01-06 04:30
    addEventListener("click", function() {
        var
              el = document.documentElement
            , rfs =
                   el.requestFullScreen
                || el.webkitRequestFullScreen
                || el.mozRequestFullScreen
        ;
        rfs.call(el);
    });
    

    As seen in this post

    0 讨论(0)
  • 2021-01-06 04:31

    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');}
    });
    
    0 讨论(0)
  • 2021-01-06 04:37

    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();
        });
    });
    
    0 讨论(0)
  • 2021-01-06 04:41
    chrome.windows.update(windowId, { state: "fullscreen" })
    

    See http://developer.chrome.com/extensions/windows.html#method-update

    0 讨论(0)
  • 2021-01-06 04:45

    Did you try the fullScreen API ?

    0 讨论(0)
提交回复
热议问题