javascript (window.open) opens maximized in all browsers but not in chrome
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)
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, 2020Comments
-
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 over 9 yearsThat's for IE, Isn't it?
-
Alaa over 9 yearsI need it maximized, Is there any way to do that? my code works fine for all browsers, Why not chrome?
-
DanielST over 9 yearsYour code doesn't work for me FF...
-
Alaa over 9 yearsI don't want it full screen, Just maximized.
-
Alaa over 9 yearsI am using FF V31, and the example in jsfiddle works fine.
-
Alaa over 9 yearsExactly, like you pressed the button between minimize and close.
-
DanielST over 9 yearsI'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 over 9 yearsI have edited the question to make it more clear.
-
Alaa over 9 yearsI believe they meant fullscreen (F11)
-
DanielST over 9 yearsNope, 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 almost 9 yearsAny solution finalized?
-
-
Alaa over 9 yearsThat'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 over 9 yearsOh, And not compatible with IE, Firefox!
-
David Roth over 3 yearsThis response makes no sense. It is not even a valid example.