javascript (window.open) opens maximized in all browsers but not in chrome

32,961

Solution 1

With the exception of IE, browsers do not support going fullscreen with JS. This is intentional:

https://developer.mozilla.org/en-US/docs/Web/API/window.open#FAQ

"All browser manufacturers try to make the opening of new secondary windows noticed by users and noticeable by users to avoid confusion, to avoid disorienting users."

You can manually set the size of the window to the screen size but you may have to deal with things like frame border thickness.

Relevant SO question: How to open maximized window with Javascript?

Working code for max size window on latest versions of IE, FF or Chrome:

window.open('http://www.stackoverflow.com','_blank','height='+screen.height+', width='+screen.width);

Solution 2

You can open window tab with below code:-

window.open(src, "newWin", "width="+screen.availWidth+",height="+screen.availHeight)
Share:
32,961
Alaa
Author by

Alaa

Software team lead, Microsoft Certified Professional Developer, MSc. IT (Semantic Computer Vision). Key Skills: Project Management, Enterprise SaaS Development, Quality Assurance, Business Analysis, .NET development, Relational and Graph Databases, Content Management Systems, Knowledge Graphs, Artificial Intelligence, Computer Vision, Machine Learning, and Semantic technologies.

Updated on September 18, 2020

Comments

  • Alaa
    Alaa over 3 years

    I am using the following code to open a maximized pop up window, i don't want to open it full screen (F11), I need it just maximized, exactly like pressing the button between minimize and close.

    <a  onclick="javascript:w= window.open('https://www.facebook.com/mywifemylove','_blank','channelmode =1,scrollbars=1,status=0,titlebar=0,toolbar=0,resizable=1');" href="javascript:void(0);" target="_blank">Maximized on Chrome</a>
    

    It's working fine for all browsers but not Chrome, Here is a jsfiddle for testing

    • Alaa
      Alaa over 9 years
      That's for IE, Isn't it?
    • Alaa
      Alaa over 9 years
      I need it maximized, Is there any way to do that? my code works fine for all browsers, Why not chrome?
    • DanielST
      DanielST over 9 years
      Your code doesn't work for me FF...
    • Alaa
      Alaa over 9 years
      I don't want it full screen, Just maximized.
    • Alaa
      Alaa over 9 years
      I am using FF V31, and the example in jsfiddle works fine.
    • Alaa
      Alaa over 9 years
      Exactly, like you pressed the button between minimize and close.
    • DanielST
      DanielST over 9 years
      I'm running an older version of FF on this computer and it doesn't maximize. I'll try it when I'm on a machine with an up to date version. I'm surprised though since they explicitly say it shouldn't work.
    • Alaa
      Alaa over 9 years
      I have edited the question to make it more clear.
    • Alaa
      Alaa over 9 years
      I believe they meant fullscreen (F11)
    • DanielST
      DanielST over 9 years
      Nope, it doesn't work on FF 32.0 on my Windows 8 machine either. So, whatever is making it work for you isn't standard. (we are looking at the same fiddle right?)
    • JGV
      JGV almost 9 years
      Any solution finalized?
  • Alaa
    Alaa over 9 years
    That's good, It's full screen but the icon's still not maximized, and the window will be behind the start bar, Is there any way to make it maximized?
  • Alaa
    Alaa over 9 years
    Oh, And not compatible with IE, Firefox!
  • David Roth
    David Roth over 3 years
    This response makes no sense. It is not even a valid example.