SitePoint Sponsor

User Tag List

Results 1 to 5 of 5
  1. #1
    SitePoint Addict
    Join Date
    Mar 2001
    Posts
    379
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Does anyone know of a script that will resize a browser? Example, A visitor goes to a page on my site, and then his window is automatically resized to a 350x400 window, with no scrollbars, and status bar.

    Please help, I've been searching the new all day for this.

    Thanks,

    Jonathan
    http://www.yeswebmaster.com

  2. #2
    SitePoint Member
    Join Date
    May 2001
    Location
    Virginia Beach, VA, USA
    Posts
    4
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I would try using something like (and this is off the top of my head, more or less, so you will need to work out the details):
    In the header:
    <script language=JavaScript>
    <!--
    function resized_screen (URL) {
    var desiredWidth = 350;
    var desiredHeight = 400;
    if (screen.width == desiredWidth && screen.height == desiredHeight) {
    return;
    }
    day = new Date();
    id = day.getTime();
    eval("page" + id + " = window.open(URL, '" + id + "', 'toolbar=0,scrollbars=0,location=0,statusbar=0,menubar=0,resizable=0,width=" + desiredWidth + ",height=" + desiredHeight + "');");
    }
    // -->
    </script>

    Then in the body tag:
    <body ... onLoad=resized_screen(window.location.href)>

    You can turn the toobar, etc., on or off by using 1 or 0, respectively.

    Cheers!
    Mike Green

  3. #3
    SitePoint Addict
    Join Date
    Mar 2001
    Posts
    379
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    For some reason, it open like 10 small pop-op windows, and doesn't resize the original browser window. Go ahead and try it and see for yourself. I appreciate the help.

    Thanks,

    Jonathan
    Owner/Webmaster
    http://www.yeswebmaster.com
    Jonathan@yesWebmaster.com

  4. #4
    SitePoint Member
    Join Date
    May 2001
    Location
    Virginia Beach, VA, USA
    Posts
    4
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Ok. Try this. It should come closer to what you want...

    <head>
    <title>Resize</title>
    <script language=JavaScript>
    <!--
    var ver_nr = '1.0';
    // -->
    </script>
    <script language=JavaScript1.1>
    <!--
    var ver_nr = '1.1';
    var alreadyOpened = false;
    // -->
    </script>
    <script language=JavaScript1.2>
    <!--
    var ver_nr = '1.2';
    var desiredWidth = 350;
    var desiredHeight = 400;
    window.resizeTo(desiredWidth, desiredHeight);
    // -->
    </script>
    <script language=JavaScript>
    <!--
    function resized_screen () {
    if (ver_nr != '1.1') return;
    if (window.opener != null && window.opener.alreadyOpened) {
    window.opener.close();
    return;
    }
    alreadyOpened = true;
    day = new Date();
    id = day.getTime();
    eval("page" + id + " = window.open(window.location.href, '" + id + "', 'toolbar=0,scrollbars=0,location=0,statusbar=0,menubar=0,resizable=0,width=" + desiredWidth + ",height=" + desiredHeight + "');");
    return;
    }
    // -->
    </script>
    </head>
    <body bgcolor="#ffffff" text="#000000" onLoad=resized_screen()>
    I'm resized!
    </body>
    Mike Green

  5. #5
    SitePoint Addict
    Join Date
    Mar 2001
    Posts
    379
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Thank you Dr. Mike. The tools bars, and status bar, etc. don't go away, but I went to some other forums, and they said that you can't make them go away.

    Thank you for the help,

    Jonathan P.
    Owner/Webmaster
    http://www.yeswebmaster.com
    Jonathan@yesWebmaster.com


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •