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

C

Charles Lavin

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
 
A

Andy

Charles Lavin said:
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
 
D

dorayme

"Andy said:
.....

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.
 
A

Andy

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.

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 ;)
 
D

dorayme

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.

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. [/QUOTE]

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!
 
A

Andy

Ben C said:
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.
 
A

Andy

Andy said:
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.
 
R

rf

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.
 
B

Beauregard T. Shagnasty

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
 
D

Doug Miller

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?
 
D

Doug Miller

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!
 
C

Chaddy2222

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".
 
B

Beauregard T. Shagnasty

Chaddy2222 said:
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.)
 
B

Beauregard T. Shagnasty

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_.
 

Ask a Question

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

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,763
Messages
2,569,562
Members
45,038
Latest member
OrderProperKetocapsules

Latest Threads

Top