Page 1 of 1

Checking to see if browser is maximized

Posted: Sun Jun 22, 2003 1:16 pm
by nigma
Could someone show me how to check to see if a browser has been maximized?

Posted: Sun Jun 22, 2003 3:15 pm
by jollyjumper
Hi Nigma,

I wouldn't know exactly how to check if the screen is maximized. What I do know is how to maximize the screen to the clients screen resolution.

Code: Select all

top.window.moveTo(0,0);
if (document.all) {
  top.window.resizeTo(screen.availWidth,screen.availHeight);
} else {
  if (document.layers||document.getElementById) {
    if top.window.outerHeight<screen.availHeight||top.window.outerWidth<screen.availWidth)&#123;
      top.window.outerHeight = screen.availHeight;
      top.window.outerWidth = screen.availWidth;
    &#125;
  &#125;
&#125;
Hope this helps you a bit.

Greetz Jolly.

Posted: Sun Jun 22, 2003 3:21 pm
by trollll
If you detect the screen dimensions and then check the window dimensions (within a range, as different browsers tell you different things even if they should have the same dimensions), maybe? Something like:

Code: Select all

<script type="text/javascript">
var maximized = false;
if ((window.outerWidth + 25 > screen.availWidth) && (window.outerHeight + 25 > screen.availHeight)) &#123;
    maximized = true;
&#125;
</script>
It won't tell you if the user has clicked the "maximize" button on the window, but it will let you know if it has about the same dimensions as the screen and it should work with most browsers and OSs.

Posted: Sun Jun 22, 2003 3:41 pm
by nigma
Thanks guys. I actually found a script on dynamic drive to maximize the browser but once the browser is maximized and then I go to another page that has the maximize code inside it, the browser like re-maximizes itself making the loading of the page weird. So I want to check to see if the browser is already maximized before using that code, like do a while loop.

while (maximized != 0)
{
// maximize browser code here
}

Posted: Mon Jun 23, 2003 8:50 am
by Gleeb
An opinion:
Self maximising pages are annoying and often get confused for pr0n popups. They'll usually get closed. Don't do it.

Posted: Fri Jun 27, 2003 1:11 pm
by elToro
Yeah, if you ever maximize my browser window, you'll live to regret it.

I run at 1600x1200, and people who run at high resolutions tend not to want something like a browser window taking up their entire screen. I have that particular JavaScript capability turned off, in fact. You're better off accepting that you don't have total control over people's browser windows.

Posted: Sat Jun 28, 2003 7:08 am
by jollyjumper
I'm sorry, I've wetten my pants from laughing.

When my site would maximize your screen, you wouldn't visit it anymore, would I regret it? I probably wouldn't even know you ever visited it.

Greetz Jolly

Posted: Sat Jun 28, 2003 7:15 am
by twigletmac
Any site that maximises the users browser is unlikely to have very many visitors staying for any length of time. I wouldn't visit twice and neither would a lot of other people. I personally would regret cutting out a lot of visitors just because I can't be bothered to design my site to deal with different resolutions and screen sizes in a user friendly way.

Mac

Posted: Sat Jun 28, 2003 9:35 am
by m3rajk
jollyjumper wrote:I'm sorry, I've wetten my pants from laughing.

When my site would maximize your screen, you wouldn't visit it anymore, would I regret it? I probably wouldn't even know you ever visited it.

Greetz Jolly
what's the point of your site?

if it is only for you, then you wont regret it, but if the point is to have it out there for others and you don't make it friendly to them, then you will regret it. why? you will be sending users away never to return