Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

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

like image 410
Alaa Avatar asked Sep 11 '14 19:09

Alaa


2 Answers

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);
like image 160
DanielST Avatar answered Oct 14 '22 07:10

DanielST


You can open window tab with below code:-

window.open(src, "newWin", "width="+screen.availWidth+",height="+screen.availHeight)
like image 35
Bunty Kumar Avatar answered Oct 14 '22 08:10

Bunty Kumar