Force reload after user changes browser size

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Paul

    Force reload after user changes browser size

    Hi,
    I'm using a little javascript to help my site's design to fit the
    visitor's entire browser window.
    Everything works great apart from one problem.
    If a visitor first loads the page and the browser isn't maximised, the
    page loads correctly BUT if the visitor then proceeds to maximize the
    browser, the page is still set for the minimised browser. This condition
    stays until the visitor goes to another section of the site or refreshes the
    page. When this happens, the page again loads correctly.
    I would like to force a page reload whenever the browser is
    minimized\maxim ized or is in any other way changed size. How can I do this?

    Thanks for your input,

    Paul


  • Lasse Reichstein Nielsen

    #2
    Re: Force reload after user changes browser size

    "Paul" <please@dontema ilmedirectly.co m> writes:
    [color=blue]
    > I'm using a little javascript to help my site's design to fit the
    > visitor's entire browser window.[/color]
    [color=blue]
    > I would like to force a page reload whenever the browser is
    > minimized\maxim ized or is in any other way changed size. How can I do this?[/color]

    Try using the window.onresize handler. Not all browsers support it. For
    those that doesn't you might want to repeatedly check whether the size
    has changed using setInterval:

    setInterval(fun ction(){if (getBrowserSize ()!=oldBrowserS ize) {refresh();}},
    200);

    (where you provide the functions to do the "right thing")

    If you use Javascript to resize the page to begin with, why not just
    call it again instead of reloading the page. Much less intrusive.
    Doesn't work if you use document.write, ofcourse. (So don't do that :)

    /L
    --
    Lasse Reichstein Nielsen - lrn@hotpop.com
    Art D'HTML: <URL:http://www.infimum.dk/HTML/randomArtSplit. html>
    'Faith without judgement merely degrades the spirit divine.'

    Comment

    • Paul

      #3
      Re: Force reload after user changes browser size

      Thanks, the window.onResize works great.

      Just have to test on different browsers to IE now.

      "Lasse Reichstein Nielsen" <lrn@hotpop.com > wrote in message
      news:llrmsqv5.f sf@hotpop.com.. .[color=blue]
      > "Paul" <please@dontema ilmedirectly.co m> writes:
      >[color=green]
      > > I'm using a little javascript to help my site's design to fit the
      > > visitor's entire browser window.[/color]
      >[color=green]
      > > I would like to force a page reload whenever the browser is
      > > minimized\maxim ized or is in any other way changed size. How can I do[/color][/color]
      this?[color=blue]
      >
      > Try using the window.onresize handler. Not all browsers support it. For
      > those that doesn't you might want to repeatedly check whether the size
      > has changed using setInterval:
      >
      > setInterval(fun ction(){if (getBrowserSize ()!=oldBrowserS ize)[/color]
      {refresh();}},[color=blue]
      > 200);
      >
      > (where you provide the functions to do the "right thing")
      >
      > If you use Javascript to resize the page to begin with, why not just
      > call it again instead of reloading the page. Much less intrusive.
      > Doesn't work if you use document.write, ofcourse. (So don't do that :)
      >
      > /L
      > --
      > Lasse Reichstein Nielsen - lrn@hotpop.com
      > Art D'HTML: <URL:http://www.infimum.dk/HTML/randomArtSplit. html>
      > 'Faith without judgement merely degrades the spirit divine.'[/color]


      Comment

      • Thomas 'PointedEars' Lahn

        #4
        Re: Force reload after user changes browser size

        Paul wrote:
        [color=blue]
        > Thanks, the window.onResize works great.[/color]

        I doubt that, since JavaScript is case-sensitive
        [color=blue]
        > Just have to test on different browsers to IE now.[/color]

        and not even IE supports "camel case" here.
        [color=blue]
        > [Top post][/color]

        Please read http://www.netmeister.org/news/learn2quote.html


        PointedEars

        Comment

        Working...