SitePoint Sponsor

User Tag List

Results 1 to 5 of 5
  1. #1
    I'm not a human
    Join Date
    Aug 2006
    Location
    India
    Posts
    281
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    How to block the resizing window using javascript?

    hi

    i want the users of site to be blocked from resizing my window.

    I tried writing a function but all went in vein..

    Code:
    function blockResize()
    {
      window.resizeTo(1024,768);
      return false;
    }
    in the html portion
    <body onresize="blockResize();">
    Please show me any other way!!
    Regards,
    Vijay
    Follow me on twitter @vijaycbe
    World Holiday Calander || My Cricket Blog

  2. #2
    Programming Team silver trophybronze trophy
    Mittineague's Avatar
    Join Date
    Jul 2005
    Location
    West Springfield, Massachusetts
    Posts
    17,260
    Mentioned
    196 Post(s)
    Tagged
    2 Thread(s)

    resize

    The question isn't how, but why? Attempting to hijack a user's browser will not please site visitors and you will lose them. Please explain your motives and a suitable alternative solution can hopefully be found.

  3. #3
    Programming Since 1978 silver trophybronze trophy felgall's Avatar
    Join Date
    Sep 2005
    Location
    Sydney, NSW, Australia
    Posts
    16,869
    Mentioned
    25 Post(s)
    Tagged
    1 Thread(s)
    Fortunately you can't override the way MY browser works with JavaScript code. Anything you do try to block in the browser will just drive away those newbie visitors who don't know how to block such stupid code.
    Stephen J Chapman

    javascriptexample.net, Book Reviews, follow me on Twitter
    HTML Help, CSS Help, JavaScript Help, PHP/mySQL Help, blog
    <input name="html5" type="text" required pattern="^$">

  4. #4
    I'm not a human
    Join Date
    Aug 2006
    Location
    India
    Posts
    281
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Ya
    i understand and i'm going to do this only after getting the option from the user to remain in full window and i'm not forcing it to all users /visitors.

    the page which i'm going to render this functionality would have contents that are visible clearly in that resolution. i know that i can use a relative design using css which would fit all screen resolution.. even though i've done it and i want this special function

    Please help me..
    Regards,
    Vijay
    Follow me on twitter @vijaycbe
    World Holiday Calander || My Cricket Blog

  5. #5
    Programming Team silver trophybronze trophy
    Mittineague's Avatar
    Join Date
    Jul 2005
    Location
    West Springfield, Massachusetts
    Posts
    17,260
    Mentioned
    196 Post(s)
    Tagged
    2 Thread(s)

    dimensions

    It is easy to be a bit confused about dimensions. Dicussions often interchange and over-lap various term definitions. There are page dimensions, the size of the page itself. There are view-port dimensions, the size of the browser window, which, when full sized, the dimensions near the numbers describing resolution. And there is screen resolution, as in pixels per area.
    Say for example, you have your monitor set at 1600x1200 with the view-port full-sized. You the design a page with graphics of a size that looks good for you and use a fixed-width layout. If someone opens another browser window and resizes both view-ports to half width, your page's browser will have horizontal scrollbars and half of the page will not be visible unless scrolled. But the images and page content will still look OK. If you use script to resize the view-port and the user wants to have 2 windows visible side-by-side, he will be annoyed.
    If someone views your page using a lower resolution, your page will not fit in the monitor's screen. If a user wants to access the page, he can simply turn off CSS so it will fit, but your layout design is not used.
    I'm sure more examples could be made, but you get the idea. Fixed-width layouts are not a good idea, and neither is forced view-port dimensions. And you have no control whatever iver someone's screen resolution any more than you do their monitor size or eyesight.
    You do not need to give users an option to have a forced full-sized view-port, Browsers already give the user the ability to have the view-port full-sized if they wish it.
    Say for example, you have tabular data that involves rows of images that must be side-by-side, and for acceptable clarity of detail must be a minimum size. Then it is best to have both hi-res and low-res versions of the images and let the page have scrollbars when neccessary.
    Believe me, you do not "want this special function".


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
  •