JavaScript & IE6: onbeforeUnload

R

R. van Laake

Hi,

I am building a webbased application for the office, and have full control
over the webserver and the clientcomputers (with IE6).

I want to prevent that the employees use Alt-F4 to close IE6. I can do that
with the onbeforeUnload, but unfortunately I always get this messagebox:

Are you sure you want to navigate away from this page?
<my message>
Press OK to continue, or Cancel to stay on the current page.

Is there ANY way to get rid of this messagebox? I simply want "to stay on
the current page" without having to press Cancel. (The employees can leave
the application by pressing F12, that sets the variable
'booleanLeaveAllowed' to true, so they don't have to "press OK to continue"
to leave the application).
As I mentioned earlier, I have control over the client computers so if I can
do it by modifying the registry, no problem. The clients have OS Windows
Workstation 4.0.


Thanks,

Ray


P.S. Please Mr. Gates, get rid of the moron that keeps on putting
messageboxes in IE you can't disable!!!! The F3 key is also useless because
after setting NoFindFiles (employees are not allowed to browse) you keep on
getting a messagebox when pressing F3 without the means to disable it from
popping up!!!!
 
R

rf

R. van Laake said:
I am building a webbased application for the office, and have full control
over the webserver and the clientcomputers (with IE6).

I want to prevent that the employees use Alt-F4 to close IE6. I can do that
with the onbeforeUnload, but unfortunately I always get this messagebox:

Are you doing this to force your viewer to "log out"? If so then:

Do you also have control over the off switch on their computer?

Can you *ensure* that windows will never crash?

In both cases booleanLeaveAllowed will never be true;
The clients have OS Windows
Workstation 4.0.

That ancient?
 
J

Jim Ley

Is there ANY way to get rid of this messagebox? I simply want "to stay on
the current page" without having to press Cancel. (The employees can leave
the application by pressing F12, that sets the variable
'booleanLeaveAllowed' to true, so they don't have to "press OK to continue"
to leave the application).

Zeepe - http://www.meadroid.com/zeepe/ will let you achieve proper
controls of this sort of application.

Jim.
 
R

R. van Laake

Are you doing this to force your viewer to "log out"?
Yes. A number of tasks has to be performed like logging their log-off time,
showing the employee the planning, etc.
Do you also have control over the off switch on their computer?
Of course not, what a stupid question. What are you implying, that I should
program nothing at all because the employees may turn off the computer,
either or not intentionally?
Can you *ensure* that windows will never crash?
If I could I would and probably be a billionaire overnight.
That ancient?
Yes, that ancient. I assume you think it would be much smarter to flush 300
NT licenses down the drain, buy 300 new XP licenses, and because of that buy
300 new computers becauze XP doesn't run that well on a Pentium I/II, and at
the end of the day realize that the tasks the computers are perfoming now
are EXACTLY the same was what they were doing before you spent all that
money. They only have to run IE6, nothing more, nothing less.


If all you can do is be a pisser please go to a toilet instead of a
newsgroup.
 
R

rf

R. van Laake whined:
Yes. A number of tasks has to be performed like logging their log-off time,
showing the employee the planning, etc.

So. I actually have guessed what you are really trying to do. I assume their
log-off time is an important piece of data.
Of course not, what a stupid question. What are you implying, that I should
program nothing at all because the employees may turn off the computer,
either or not intentionally?

The point of this question was to point out to you that you can not possibly
know in all instances when a user stops using your site. So, you will never,
in this instance, determine their log-off time.
If I could I would and probably be a billionaire overnight.

The point of this question was to point out to you that you can not possibly
know in all instances when a user stops using your site. So, you will never,
in this instance, determine their log-off time.
Yes, that ancient.

Sorry, that was meant to be tongue in cheek. :)

I am aware that many people choose to stay with NT4 for whatever reason, and
rightly so.
If all you can do is be a pisser please go to a toilet instead of a
newsgroup.

So, you choose to call me a pisser for asking the obvious questions? The
questions you never even thought of?

What would happen when you present your boss with a solution that does not
take these quesions into account.

What happens when he simply turns his computer off and finds that he is
"logged-in" for the entire weekend?

What happens when he asks you "why?".

Would you call him a pisser?

You can *not* determine when a user has stopped using your site. You can
*ask* the user to tell you by using a log off link or something but you can
not *force* this. The very best you can do is something like a session
cookie that times out after, how long, lets pick 10 minutes. Of course then
when your user ducks out for a coffee a log off will occur.
 
M

Michael Winter

[snip]
I want to prevent that the employees use Alt-F4 to close IE6. I can do
that with the onbeforeUnload, but unfortunately I always get this
messagebox:

Are you sure you want to navigate away from this page?
<my message>
Press OK to continue, or Cancel to stay on the current page.

Is there ANY way to get rid of this messagebox?

No. It is a security measure. Even HTAs display the extra text.

[snip]

Mike
 
R

R. van Laake

Sorry that I let myself go in that way, but it seemed like the only reason
you answered my post was to be a smartass
So, you choose to call me a pisser for asking the obvious questions? The
questions you never even thought of?

I have been a programmer for this company for a very long time and know my
way around these problems. Yes, I have thought of these questions, in fact
many years ago. My previous DOS based app has worked well for years and
answered those questions well, and the webbased thing will do so too. I just
need to know more about the tricks behind webbased programming (most is
ready anyway).
You can *not* determine when a user has stopped using your site. You can
*ask* the user to tell you by using a log off link or something but you can
not *force* this. The very best you can do is something like a session
cookie that times out after, how long, lets pick 10 minutes. Of course then
when your user ducks out for a coffee a log off will occur.

About the session cookie: indeed, that's a way.
We "force" the employee to log out in an orderly manner by saying he won't
get paid if he doesn't do so... if his time isn't logged we can't bill the
clients, so no money comes in, so there's nothing to pay him with. Obviously
we're not that rigid, but the message does get across.
About the toilet: apart from that it is allowed, we also have a supervisor
to check that doesn't get out of hand.... can't expect to have the computer
do everything for oyu.
 
R

Randy Webb

am9518 said:
function CloseIT()
{
window.opener=null; window.close(); return false;
}

works fine for me!

And where exactly did you test that code?

"works fine for me" doesn't make code that works in a cross-browser
environment.
 
R

Randy Webb

am9518 said:
hmmm I can't get the code to paste in the reply. It keeps closing my
window... hmmmm.

Then use a decent newsreader instead of a website to post from.
 
E

evilmousse

I want to prevent that the employees use Alt-F4 to close IE6. I can do
that with the onbeforeUnload, but unfortunately I always get this
messagebox:

Are you sure you want to navigate away from this page?
<my message>
Press OK to continue, or Cancel to stay on the current page.

Is there ANY way to get rid of this messagebox?

No. It is a security measure. Even HTAs display the extra text.
[snip]
Michael Winter
Replace ".invalid" with ".uk" to reply by e-mail.

Thank you very much for giving the closest thing to an answer I've yet
come accross, this is VERY hard to find info on.

All I want to do is switch the priority of this window so cancel is the
default and buttonmashers don't accidentally leave the page.

after days of websearching and confirm windows with verbage like
"false" and "null" i'd like to give some ie programmers a peice of my
mind...
 

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

Forum statistics

Threads
473,996
Messages
2,570,238
Members
46,826
Latest member
robinsontor

Latest Threads

Top