Waiting for a window to close -- without killing the CPU

Discussion in 'HTML' started by Charles Lavin, Aug 8, 2009.

  1. Hi --

    I have a Web page. When a user clicks on a link on this page, I need a
    pop-up window to open; that window will execute server-side code. When this
    window is closed (and not before), I need the main page to reload.

    I coded this for the link, which works:

    <a onclick="w = window.open('whatever'); while (!(w.closed));
    location.reload(); return false;" href="whatever">CLICK HERE</a>

    The user clicks on the link on the main page, does what he needs to do on
    the pop-up window, closes that pop-up window, and the main page
    automatically reloads.

    However, I have noticed that when that pop-up window opens, the process
    associated with the main window chews up all of the available CPU. I suspect
    it's that while statement spinning in place with nothing to do.

    Is there a cleaner way to do what I need to do, or at least one that won't
    chew up the CPU?

    Is there a way for that pop-up window to force a reload of the main page
    before it closes?

    Thanks,
    CL
     
    Charles Lavin, Aug 8, 2009
    #1
    1. Advertising

  2. Charles Lavin

    Andy Guest

    "Charles Lavin" <> wrote in message
    news:On4fm.96762$...
    > Hi --
    >
    > I have a Web page. When a user clicks on a link on this page, I need a
    > pop-up window to open; that window will execute server-side code. When
    > this window is closed (and not before), I need the main page to reload.
    >
    > I coded this for the link, which works:
    >
    > <a onclick="w = window.open('whatever'); while (!(w.closed));
    > location.reload(); return false;" href="whatever">CLICK HERE</a>
    >
    > The user clicks on the link on the main page, does what he needs to do on
    > the pop-up window, closes that pop-up window, and the main page
    > automatically reloads.
    >
    > However, I have noticed that when that pop-up window opens, the process
    > associated with the main window chews up all of the available CPU. I
    > suspect it's that while statement spinning in place with nothing to do.
    >
    > Is there a cleaner way to do what I need to do, or at least one that won't
    > chew up the CPU?
    >
    > Is there a way for that pop-up window to force a reload of the main page
    > before it closes?
    >
    > Thanks,
    > CL
    >
    >


    Hi Charles,

    Haven't got time to give you a full in-depth answer as I've got to go out,
    but if you visit my site...

    www.microbuild.com

    and click the image to the right of the Microbuild title (initially "Under
    Construction" then text alerts, then tour) it will start the site tour (i.e.
    will launch the popup).

    You have to go at least one step into the tour before the code is used. Now
    you can examine the source to get the idea. Basically, if the user clicks
    any button that continues the tour, the code in question does nothing, but
    if the user closes the tour popup or reaches the end then it loads a thank
    you page into the main/original content frame.

    The technique allows you to control the original content from the popup,
    even run scripts etc.

    You should get the gist if not I'll help when I'm back.


    Andy
     
    Andy, Aug 8, 2009
    #2
    1. Advertising

  3. Charles Lavin

    dorayme Guest

    In article <pDafm.179997$2>,
    "Andy" <> wrote:

    >
    > "Charles Lavin" <> wrote in message
    > news:On4fm.96762$...
    > > Hi --
    > >
    > > I have a Web page. When a user clicks on a link on this page, I need a
    > > pop-up window to open; that window will execute server-side code. When
    > > this window is closed (and not before), I need the main page to reload.
    > >

    .....
    >
    > Hi Charles,
    >
    > Haven't got time to give you a full in-depth answer as I've got to go out,
    > but if you visit my site...
    >
    > www.microbuild.com


    Being how this is posted to alt.html, be careful of using this site as a
    model for general markup or design or CSS, the author seems unaware of
    fundamental usability issues. Apart for errors in validation, see what
    happens when user uses a text size that the author never anticipated
    even though the trouble starts at just one click up in "text only"
    enlargement.

    --
    dorayme
     
    dorayme, Aug 9, 2009
    #3
  4. Charles Lavin

    Andy Guest

    > Being how this is posted to alt.html, be careful of using this site as a
    > model for general markup or design or CSS, the author seems unaware of
    > fundamental usability issues. Apart for errors in validation, see what
    > happens when user uses a text size that the author never anticipated
    > even though the trouble starts at just one click up in "text only"
    > enlargement.
    >
    > --
    > dorayme


    Seeing as this is posted to alt.html, be careful when taking this guy's
    advice as he has an irresistible urge to change the text size of every site
    he visits despite having perfectly good eyesight just so that he can
    criticize. Why he doesn't use the zoom function is a mystery and one can
    only assume that his false eyesight issue only affects text. As an ex
    hallway monitor, he has a penchant for rule breaking and believes that only
    sites that pass strict validation are worth looking at despite the fact that
    none of the top sites in the world pass and that the validation tool often
    gives false results.


    Andy ;)
     
    Andy, Aug 11, 2009
    #4
  5. Charles Lavin

    dorayme Guest

    In article <6a9gm.88611$2>,
    "Andy" <> wrote:

    > > Being how this is posted to alt.html, be careful of using this site as a
    > > model for general markup or design or CSS, the author seems unaware of
    > > fundamental usability issues. Apart for errors in validation, see what
    > > happens when user uses a text size that the author never anticipated
    > > even though the trouble starts at just one click up in "text only"
    > > enlargement.
    > >
    > > --
    > > dorayme

    >
    > Seeing as this is posted to alt.html, be careful when taking this guy's
    > advice as he has an irresistible urge to change the text size of every site
    > he visits despite having perfectly good eyesight just so that he can
    > criticize.


    Hello, hello, hello! What have we here? I am being criticized for being
    concerned that website makers take account of people with even
    *slightly* different eyesight to me?

    > Why he doesn't use the zoom function is a mystery and one can
    > only assume that his false eyesight issue only affects text.


    It is a sign of false eyesight not to want pics zoomed or to use
    browsers that do not do general zooming? Or, much more to the point, to
    draw attention to the good practice of not assuming that everyone zooms
    the same way?

    > As an ex
    > hallway monitor, he has a penchant for rule breaking and believes that only
    > sites that pass strict validation are worth looking at


    Your evidence for this? My evidence says most sites I look at do not
    pass validation and some are pretty good anyway...

    You are very familiar with me young man!

    --
    dorayme
     
    dorayme, Aug 11, 2009
    #5
  6. Charles Lavin

    Andy Guest

    "Ben C" <> wrote in message
    news:...
    > On 2009-08-11, Andy <> wrote:
    >>> Being how this is posted to alt.html, be careful of using this site as a
    >>> model for general markup or design or CSS, the author seems unaware of
    >>> fundamental usability issues. Apart for errors in validation, see what
    >>> happens when user uses a text size that the author never anticipated
    >>> even though the trouble starts at just one click up in "text only"
    >>> enlargement.
    >>>
    >>> --
    >>> dorayme

    >>
    >> Seeing as this is posted to alt.html, be careful when taking this guy's
    >> advice as he has an irresistible urge to change the text size of every
    >> site
    >> he visits despite having perfectly good eyesight just so that he can
    >> criticize. Why he doesn't use the zoom function is a mystery and one can
    >> only assume that his false eyesight issue only affects text. As an ex
    >> hallway monitor, he has a penchant for rule breaking and believes that
    >> only
    >> sites that pass strict validation are worth looking at despite the fact
    >> that
    >> none of the top sites in the world pass and that the validation tool
    >> often
    >> gives false results.

    >
    > Do you have an example of the validation tool giving false results? I
    > don't mean bogus warnings (they are to be expected).


    Sure...

    http://validator.w3.org/check?uri=w...(detect automatically)&doctype=Inline&group=0

    Gives 2 warnings and 69 errors. Now start to read the errors and you'll soon
    realise that that the validator is complaining that I have used capitals
    (not exactly crime of the century is it?). Now go visit www.microbuild.com
    and check the source... guess what? I don't use capitals at all.


    Andy


    Anyhoo, let's not get off topic (I know some people revel in dragging out
    differences of opinion). Regardless of my coding style etc, there is a
    solution to the OP question which I think works quite well.
     
    Andy, Aug 11, 2009
    #6
  7. Charles Lavin

    Andy Guest

    "Andy" <> wrote in message
    news:Wuagm.251069$2...
    >
    > "Ben C" <> wrote in message
    > news:...
    >> On 2009-08-11, Andy <> wrote:
    >>>> Being how this is posted to alt.html, be careful of using this site as
    >>>> a
    >>>> model for general markup or design or CSS, the author seems unaware of
    >>>> fundamental usability issues. Apart for errors in validation, see what
    >>>> happens when user uses a text size that the author never anticipated
    >>>> even though the trouble starts at just one click up in "text only"
    >>>> enlargement.
    >>>>
    >>>> --
    >>>> dorayme
    >>>
    >>> Seeing as this is posted to alt.html, be careful when taking this guy's
    >>> advice as he has an irresistible urge to change the text size of every
    >>> site
    >>> he visits despite having perfectly good eyesight just so that he can
    >>> criticize. Why he doesn't use the zoom function is a mystery and one can
    >>> only assume that his false eyesight issue only affects text. As an ex
    >>> hallway monitor, he has a penchant for rule breaking and believes that
    >>> only
    >>> sites that pass strict validation are worth looking at despite the fact
    >>> that
    >>> none of the top sites in the world pass and that the validation tool
    >>> often
    >>> gives false results.

    >>
    >> Do you have an example of the validation tool giving false results? I
    >> don't mean bogus warnings (they are to be expected).

    >
    > Sure...
    >
    > http://validator.w3.org/check?uri=w...(detect automatically)&doctype=Inline&group=0
    >
    > Gives 2 warnings and 69 errors. Now start to read the errors and you'll
    > soon realise that that the validator is complaining that I have used
    > capitals (not exactly crime of the century is it?). Now go visit
    > www.microbuild.com and check the source... guess what? I don't use
    > capitals at all.
    >
    >
    > Andy
    >
    >
    > Anyhoo, let's not get off topic (I know some people revel in dragging out
    > differences of opinion). Regardless of my coding style etc, there is a
    > solution to the OP question which I think works quite well.


    Phooey! I have got some capitals in there... but not all the ones that the
    validator complains about.
     
    Andy, Aug 11, 2009
    #7
  8. Charles Lavin

    rf Guest

    "Andy" <> wrote in message
    news:6a9gm.88611$2...
    >> Being how this is posted to alt.html, be careful of using this site as a
    >> model for general markup or design or CSS, the author seems unaware of
    >> fundamental usability issues. Apart for errors in validation, see what
    >> happens when user uses a text size that the author never anticipated
    >> even though the trouble starts at just one click up in "text only"
    >> enlargement.
    >>
    >> --
    >> dorayme


    Strike zero. Quoting signatures on usenet. I'll let you off on that one
    though.

    > Seeing as this is posted to alt.html, be careful when taking this guy's


    Strike one. dorayme is a girl, as you might have ascertained if you had hung
    around for the requisite week or so before barging in here.

    And when you post to alt.html be very very prepared to have anything you
    exhibit to be critically appraised by people who can probably write web
    pages far far better that you can.

    > advice as he has an irresistible urge to change the text size of every
    > site he visits


    Strike two. Who are you to dictate what your viewer does with her quite
    valid browser settings? Those settings are there for a *reason*
    (accessibility), or do you think browser manufacturers simply put them in
    there so dorayme can use them to break your site?

    > despite having perfectly good eyesight


    Strike three. How can you be so arrogant to presume that everybody on this
    planet has eyesight as good as yours.

    FWIW I have somewhat bad eyesight and I found your pitifully small 10 pixel
    text hard to read, even with my especially designed computer glasses.

    Some people (and I, occasionally) set their quite valid browser settings so
    as to enforce a minimum font size of, say,18 pixels. This quite valid
    browser setting destroys your web site. Who is to blame for this? The
    browser manufactures who provided the setting? The viewer who has usilised
    the setting? You? I think *I* know who is to blame :)

    > just so that he can criticize.


    Strike four. Not criticism. Just plainly stating that your site breaks
    accessibility rules. You posted to a newsgroup dedicated to using HTML to
    build *good* web sites, accessible to everybody, regardless of their visual
    acuity. Yours it not a good web site. Expect, accept and utilize the
    critique.

    > Why he doesn't use the zoom function is a mystery


    Strike five. Perhaps doraymes browser does not *have* a zoom function that
    enlarges the entire page. Some of mine don't. And the ones that do I turn
    the function off as it pisses me right off to have a permanent horizontal
    scroll bar.

    > and one can only assume that his[her] false eyesight issue only affects
    > text.


    Strike six. Another arrogant assumption that we actually need to enlarge the
    images as well as the text. Look at your page, the images are largely eye
    candy. This apart from the fact that you are implying that dorayme is lying
    about her visual skills.

    > As an ex hallway monitor, he has a penchant for rule breaking and
    > believes that only sites that pass strict validation are worth looking at


    Strike seven. Once again apart from the strawman argument, if you really
    believe that invalid HTML is worthwhile then simply wait until the next
    release of <pick your browser> error corrects your invalid code in a way
    that breaks your site. It happens all the time with invalid code presented
    to the most used browser out there.

    > despite the fact that none of the top sites in the world pass and that the
    > validation tool often gives false results.


    Strike eight. The standard lemming approach to validation. Heard here quite
    often.

    Eight strikes. Andy, you are... out.
     
    rf, Aug 11, 2009
    #8
  9. In alt.html, Andy wrote:

    > Sure...
    >
    > http://validator.w3.org/check?uri=w...(detect automatically)&doctype=Inline&group=0
    >
    > Gives 2 warnings and 69 errors. Now start to read the errors and
    > you'll soon realise that that the validator is complaining that I
    > have used capitals (not exactly crime of the century is it?). Now go
    > visit www.microbuild.com and check the source... guess what? I don't
    > use capitals at all.


    I see capital letters ... but perhaps you wouldn't have errors if you
    used the correct DOCTYPE for your document.

    You are using FRAMES (de Lawd only knows why!) without a FRAMESET
    doctype. Try:

    <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Frameset//EN"
    "http://www.w3.org/TR/html4/frameset.dtd">

    See: http://www.w3.org/QA/2002/04/valid-dtd-list.html

    --
    -bts
    -Friends don't let friends drive Windows
     
    Beauregard T. Shagnasty, Aug 11, 2009
    #9
  10. Charles Lavin

    Doug Miller Guest

    In article <6a9gm.88611$2>, "Andy" <> wrote:

    >Seeing as this is posted to alt.html, be careful when taking this guy's
    >advice as he has an irresistible urge to change the text size of every site
    >he visits despite having perfectly good eyesight just so that he can
    >criticize.


    You're evidently fairly young. Not everyone who looks at your site is. I'm 51,
    and wear bifocals -- and some of the text on your site is difficult for me to
    read unless I zoom the browser a bit.

    >Why he doesn't use the zoom function is a mystery and one can
    >only assume that his false eyesight issue only affects text.


    I imagine that he does use it -- but I also imagine that he's not using
    Internet Explorer, which apparently is the *only* browser in which you've
    *ever* tested the site. In both Firefox 3 and Safari, your layout problems
    become apparent with a single zoom step (press Ctrl-plus) -- and in Opera, the
    problems are glaringly obvious, even *without* zooming, as soon as the page
    finishes loading.

    Speaking of which... why does that page take so damn long to load? Have you
    ever actually visited the site, or do you do all your testing using Apache or
    IIS locally?
     
    Doug Miller, Aug 11, 2009
    #10
  11. Charles Lavin

    Doug Miller Guest

    In article <Jkcgm.10939$>, "rf" <> wrote:

    >Strike zero. Quoting signatures on usenet. I'll let you off on that one
    >though.

    [...]
    >
    >Eight strikes. Andy, you are... out.


    And if you had counted the first one, he'd have an entire inning's worth of
    strikeouts, all in just one post. Impressive!
     
    Doug Miller, Aug 11, 2009
    #11
  12. Charles Lavin

    Chaddy2222 Guest

    On Aug 11, 9:10 pm, "rf" <> wrote:
    > "Andy" <> wrote in message
    >
    > news:6a9gm.88611$2...
    >
    > >> Being how this is posted to alt.html, be careful of using this site as a
    > >> model for general markup or design or CSS, the author seems unaware of
    > >> fundamental usability issues. Apart for errors in validation, see what
    > >> happens when user uses a text size that the author never anticipated
    > >> even though the trouble starts at just one click up in "text only"
    > >> enlargement.

    >
    > >> --
    > >> dorayme

    >
    > Strike zero. Quoting signatures on usenet. I'll let you off on that one
    > though.
    >
    > > Seeing as this is posted to alt.html, be careful when taking this guy's

    >
    > Strike one. dorayme is a girl, as you might have ascertained if you had hung
    > around for the requisite week or so before barging in here.
    >
    > And when you post to alt.html be very very prepared to have anything you
    > exhibit to be critically appraised by people who can probably write web
    > pages far far better that you can.
    >
    > > advice as he has an irresistible urge to change the text size of every
    > > site he visits

    >
    > Strike two. Who are you to dictate what your viewer does with her quite
    > valid browser settings? Those settings are there for a *reason*
    > (accessibility), or do you think browser manufacturers simply put them in
    > there so dorayme can use them to break your site?
    >
    > > despite having perfectly good eyesight

    >
    > Strike three. How can you be so arrogant to presume that everybody on this
    > planet has eyesight as good as yours.
    >
    > FWIW I have somewhat bad eyesight and I found your pitifully small 10 pixel
    > text hard to read, even with my especially designed computer glasses.
    >
    > Some people (and I, occasionally) set their quite valid browser settings so
    > as to enforce a minimum font size of, say,18 pixels. This quite valid
    > browser setting destroys your web site. Who is to blame for this? The
    > browser manufactures who provided the setting? The viewer who has usilised
    > the setting? You? I think *I* know who is to blame :)
    >

    That would be the author of the website in question. ]

    > > just so that he can criticize.

    >
    > Strike four. Not criticism. Just plainly stating that your site breaks
    > accessibility rules. You posted to a newsgroup dedicated to using HTML to
    > build *good* web sites, accessible to everybody, regardless of their visual
    > acuity. Yours it not a good web site. Expect, accept and utilize the
    > critique.
    >

    I think you will find that Andy has got similar notifications about
    his website before. Look through the alt.html.critique archive for his
    domain name on on the archives of that group through Google.


    > > Why he doesn't use the zoom function is a mystery

    >
    > Strike five. Perhaps doraymes browser does not *have* a zoom function that
    > enlarges the entire page. Some of mine don't. And the ones that do I turn
    > the function off as it pisses me right off to have a permanent horizontal
    > scroll bar.
    >
    > > and one can only assume that his[her] false eyesight issue only affects
    > > text.

    >
    > Strike six. Another arrogant assumption that we actually need to enlarge the
    > images as well as the text. Look at your page, the images are largely eye
    > candy. This apart from the fact that you are implying that dorayme is lying
    > about her visual skills.
    >
    > > As an ex hallway monitor, he has a penchant for rule breaking and
    > > believes that only sites that pass strict validation are worth looking at

    >
    > Strike seven. Once again apart from the strawman argument, if you really
    > believe that invalid HTML is worthwhile then simply wait until the next
    > release of <pick your browser> error corrects your invalid code in a way
    > that breaks your site. It happens all the time with invalid code presented
    > to the most used browser out there.
    >
    > > despite the fact that none of the top sites in the world pass and that the
    > > validation tool often gives false results.

    >
    > Strike eight. The standard lemming approach to validation. Heard here quite
    > often.
    >
    > Eight strikes. Andy, you are... out.

    On the topic of validation I read a message in another NG just before,
    from a web designer / developer saying that "IE6 is still the best
    browser on the market".
    --
    Regards Chad. http://freewebdesignonline.org.au
     
    Chaddy2222, Aug 11, 2009
    #12
  13. Chaddy2222 wrote:

    > On the topic of validation I read a message in another NG just before,
    > from a web designer / developer saying that "IE6 is still the best
    > browser on the market".


    Which millennium was that written in, Chaddy? :)

    (Please trim next time... thanks.)

    --
    -bts
    -Friends don't let friends drive Windows
     
    Beauregard T. Shagnasty, Aug 11, 2009
    #13
  14. Charles Lavin

    Chaddy2222 Guest

    Chaddy2222, Aug 11, 2009
    #14
  15. Chaddy2222 wrote:
    > On Aug 12, 2:45 am, "Beauregard T. Shagnasty"
    > <> wrote:
    >> Chaddy2222 wrote:
    >>> On the topic of validation I read a message in another NG just before,
    >>> from a web designer / developer saying that "IE6 is still the best
    >>> browser on the market".

    >> Which millennium was that written in, Chaddy? :)
    >>

    > That post was written yesterday would you believe.
    > http://groups.google.com.au/group/b.../browse_thread/thread/906c1e81dcd97260?hl=en#


    Sure that was a web deziner! He also might be a paid promoter for our
    friend AW

    --
    Take care,

    Jonathan
    -------------------
    LITTLE WORKS STUDIO
    http://www.LittleWorksStudio.com
     
    Jonathan N. Little, Aug 11, 2009
    #15
  16. Jonathan N. Little wrote:

    > Chaddy2222 wrote:
    >>"Beauregard T. Shagnasty" wrote:
    >>> Chaddy2222 wrote:
    >>>> On the topic of validation I read a message in another NG just
    >>>> before, from a web designer / developer saying that "IE6 is still
    >>>> the best browser on the market".
    >>>
    >>> Which millennium was that written in, Chaddy? :)
    >>>

    >> That post was written yesterday would you believe.
    >> http://groups.google.com.au/group/b.../browse_thread/thread/906c1e81dcd97260?hl=en#


    Oh my. He also seems to advocate HTML 3.2! There's a sign.

    Oh my! That's what he uses on his own bizynet.com site! <shudder>
    ...which also looks as if it (dezine *&* code) was churned out with
    FrontPlague 98 or sumpin'.

    > Sure that was a web deziner! He also might be a paid promoter for our
    > friend AW


    Heh, I thought exactly the same thing as soon as I got to the last
    paragraph. <g>

    "Biz" always turns me _right_off_.

    --
    -bts
    -Friends don't let friends drive Windows
     
    Beauregard T. Shagnasty, Aug 11, 2009
    #16
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Alessandro Giambruno

    Waiting until timer without cpu crash?

    Alessandro Giambruno, Jun 18, 2004, in forum: Java
    Replies:
    9
    Views:
    2,916
    Roedy Green
    Jun 22, 2004
  2. Walter Beierdonck

    Self.close() window without the dialog close?Yes/NO

    Walter Beierdonck, Apr 29, 2004, in forum: Javascript
    Replies:
    1
    Views:
    371
    Grant Wagner
    Apr 30, 2004
  3. Public Interest
    Replies:
    0
    Views:
    166
    Public Interest
    Oct 20, 2003
  4. PerlFAQ Server
    Replies:
    0
    Views:
    194
    PerlFAQ Server
    Apr 23, 2011
  5. Shang Wenbin

    close current window using window.close()

    Shang Wenbin, Sep 1, 2005, in forum: Javascript
    Replies:
    10
    Views:
    423
    Gérard Talbot
    Sep 2, 2005
Loading...

Share This Page