Results 1 to 7 of 7

Thread: Browser Window resolution/size define buttons

  1. #1
    Join Date
    Apr 2007
    Posts
    7
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Browser Window resolution/size define buttons

    Hi,

    I was wondering if there is a way to have buttons/links on my web site that allows the user to manually select how large the browser window is on his/her monitor.

    I want users to be able to select from either 1024 x 768 or 1280 x 1024. The reason for this is that my site looks good at these window sizes/resolutions. With wide screen monitors now pages on my site can get distorted/stretched easily. Someday I wll hire a pro to redesign the site but until then, I will live with what I have.

    Here is a simple script that defaults the browser window to 1024 x 768. The problem is that I want the user to be able to select what size window they want and have all pages show up that size. This assumes that the person does not adjust the size after selecting the window size command from my site.


    <script language="JavaScript" type="text/JavaScript">
    <!--
    if(window.resizeTo) self.resizeTo(1024,768);
    //-->
    </script>

    Thanks

  2. #2
    Join Date
    Jul 2006
    Location
    just north of Boston, MA
    Posts
    1,806
    Thanks
    13
    Thanked 72 Times in 72 Posts

    Default

    place in <head> tag
    Code:
    <script type="text/javascript">
    function resizeBrowser(w,h)
    {
         window.resizeTo(w,h)
    }
    </script>
    place where ever you wish to resize and just change the values
    Code:
    <h2>Screen Resolution</h2>
    <a href="resizeBrowser(800, 600)">800x600</a>
    <a href="resizeBrowser(1024, 800)">1024x760</a>
    <a href="resizeBrowser(1280,1024)">1280x1024</a>
    I would note though that you will need to adjust the widths so that the user will not have to horizontal scroll

    and also, not everyone is going ot have a large screen resolution. so you want to be sure that your site doesnt "break" for someone on a lesser screen resolution, such as 800x600 - which there are plenty of people still using.

  3. #3
    Join Date
    Apr 2007
    Posts
    7
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    Hi,

    You make a great point regarding the breaking of lower resolutions 800 x 600. This is why I had hoped to be able to have multiple buttons displayed on every page.

    If someone found a page in my site via search engine all 3 buttons would be available no matter what page was called.

    800 x 600
    1024 x 768
    1280 x 1024

    once selected the browser window becomes the proper size. Then it will stay that size unless the person manually drags the window to a different size.

    Can a button or link selection be made to do the browser resizing? This way the user chooses what resolution they want the window to display at.

    Thanks

  4. #4
    Join Date
    Jul 2006
    Location
    just north of Boston, MA
    Posts
    1,806
    Thanks
    13
    Thanked 72 Times in 72 Posts

    Default

    <h2>Screen Resolution</h2>
    <a href="resizeBrowser(800, 600)">800x600</a>
    <a href="resizeBrowser(1024, 800)">1024x760</a>
    <a href="resizeBrowser(1280,1024)">1280x1024</a>
    those are links??
    are you talking about a dropdown menu?
    Code:
    <h2>Screen Resolution</h2>
    <select onchange="resizeBrowser(this.selectedIndex)">
         <option value="800,600">800x600</option>
         <option value="1024,800">1024x800</option>
         <option value="1280,1024">1280x1024</option>
    </select>
    or buttons
    Code:
    <input type="button" name="browser" value="800x600" onclick=resizeBrowser(800,600)">
    <input type="button" name="browser" value="1024x800" onclick=resizeBrowser(1024,800)">
    <input type="button" name="browser" value="1280x1024" onclick=resizeBrowser(1280,1024)">

  5. #5
    Join Date
    Apr 2007
    Posts
    7
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    Hi,

    I am a newbie at all of this and not much of a programmer at all. More cut & paste and figure out what I did wrong to make it work.

    I will play with what you have been kind enough to show me. I am sure I can figure it out once I see how it reacts.

    Thanks

  6. #6
    Join Date
    Apr 2007
    Posts
    7
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    Hi,

    I cannot get this to work...

    I keep getting this error message

    firefox can't find the file at /D:/HPS/09-10-2007/resizeBrowser(1024, 800)

    Any idea what this means.

    Thanks

    Ron

  7. #7
    Join Date
    Apr 2007
    Posts
    7
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Finally got it to work...

    Hi,

    This is how I got the text links to work....

    header

    <script type="text/javascript">
    function resizeBrowser(w,h)
    {
    window.resizeTo(w,h)
    }
    </script>



    where ever you want to be displayed

    <h2>Screen Resolution</h2>
    <a href="javascript:resizeBrowser(800, 600)">800x600</a>
    <a href="javascript:resizeBrowser(1024, 760)">1024x760</a>
    <a href="javascript:resizeBrowser(1280,1024)">1280x1024</a>


    Thanks for all the help, I appreciate it.

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
  •