/    Sign up×
Community /Pin to ProfileBookmark

Resizing browser window if less than a specific size

What I would like to do is create a function where if the window size is less than 800 x 600, then the window gets resized to 800 x 600.
If it is greater or equal to that, nothing happens.
If possible, I need it to work on IE and Netscape.

Thanks.
Stephen C

to post a comment
JavaScript

3 Comments(s)

Copy linkTweet thisAlerts:
@felgallJun 17.2005 — Resizing the browser window to that size is only possible where:

  • 1. Your javascript opened the window in the first place and

  • 2. The screen is at least 850 x 700 so that the browser window will fit along with the other items that always take up space on the screen.
  • Copy linkTweet thisAlerts:
    @stc60authorJun 18.2005 — The script I use now is:

    function maxWindow(){

    if (document.all) {

    intwidth=window.screen.availWidth;

    intheight=window.screen.availHeight;

    }else {

    intwidth=800;

    intheight=600;

    }

    window.moveTo(0,0);

    window.resizeTo(intwidth,intheight);

    }
    ----------------------------


    The problem is, it maximizes the window in IE, and in

    Netscape it does indeed resize it to 800 x 600.

    (But obviously that is annoying if it is bigger to begin width)

    I was just wondering if all I need is an if-then statement involving

    inequalities to only resize the window only if it

    is less than 800 x 600.
    Copy linkTweet thisAlerts:
    @felgallJun 18.2005 — Current available area within browser window (excluding the browser "chrome").

    [b]function pageWidth() {return window.innerWidth != null? window.innerWidth: document.body != null? document.body.clientWidth:null;}

    function pageHeight() {return window.innerHeight != null? window.innerHeight: document.body != null? document.body.clientHeight:null;}[/b]


    current actual screen size in all browsers (excluding start bar etc)

    [b]screen.availWidth[/b] and [b]screen.availHeight[/b]

    Actual browser size (not supported by IE)

    [b]screen.outerWidth[/b] and [b]screen.outerHeight[/b]

    For IE you could work out the extra space required for the browser itself and add that to the interior size.
    ×

    Success!

    Help @stc60 spread the word by sharing this article on Twitter...

    Tweet This
    Sign in
    Forgot password?
    Sign in with TwitchSign in with GithubCreate Account
    about: ({
    version: 0.1.9 BETA 5.6,
    whats_new: community page,
    up_next: more Davinci•003 tasks,
    coming_soon: events calendar,
    social: @webDeveloperHQ
    });

    legal: ({
    terms: of use,
    privacy: policy
    });
    changelog: (
    version: 0.1.9,
    notes: added community page

    version: 0.1.8,
    notes: added Davinci•003

    version: 0.1.7,
    notes: upvote answers to bounties

    version: 0.1.6,
    notes: article editor refresh
    )...
    recent_tips: (
    tipper: @AriseFacilitySolutions09,
    tipped: article
    amount: 1000 SATS,

    tipper: @Yussuf4331,
    tipped: article
    amount: 1000 SATS,

    tipper: @darkwebsites540,
    tipped: article
    amount: 10 SATS,
    )...