473,407 Members | 2,598 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,407 software developers and data experts.

Detecting stop button...presumably with JavaScript

Hello. I'm wondering if someone can answer something I'm sure has been
answered a thousand times before. I am apparently just too dumb to
find the answer. :) I've found information about the 'onstop' event,
but it's not behaving as expected. (And it also seems to be a
proprietary attribute) That is, my defined function is not being run
when I click stop. I've 'inserted' it like this:
<body onstop="stopped_clicked()">
And the function just grabs the id of the content div, then changes the
innerHTML. Except that's not what happens. :) Nothing happens.

Oh, about the question. I'm trying to determine if the user clicks the
stop button during a post send, basically. Specifically, if a user is
uploading a file to my server, and they click stop at some point, I
need to be able to tell the server that stop was clicked, so it doesn't
think that's the whole file. I've noticed that an error message is
written to the Apache log, but that seems like a strange way to keep
track of user-interrupted events. (Note: this is Apache/mod_perl
server-side)

I guess what I'm thinking now is that JavaScript detects the stop
(since it is client-side), then sends a message to the server that an
error occurred, or something. Like I said, the onstop event is not
doing what I'm expecting, and Firefox doesn't like it anyway, not to
metion the other browsers out there. So my question is what's the
"idiom" or "standard way" of detecting this sort of situation. I'm
quite certain I'm not the first one to need it. It just seems I'm one
of the ones who has to ask. :)

Thanks for any help,
jab3

Mar 6 '06 #1
7 2248
jab3 wrote on 06 mrt 2006 in comp.lang.javascript:
<body onstop="stopped_clicked()">
And the function just grabs the id of the content div, then changes the
innerHTML. Except that's not what happens. :) Nothing happens.


If you mean by "onstop" that the execution of javascript has stopped,
you should understand that such "onstop" cannot execute javascript.

--
Evertjan.
The Netherlands.
(Please change the x'es to dots in my emailaddress)
Mar 6 '06 #2
jab3 wrote:
Oh, about the question. I'm trying to determine if the user clicks the
stop button during a post send, basically. Specifically, if a user is
uploading a file to my server, and they click stop at some point, I
need to be able to tell the server that stop was clicked, so it doesn't
think that's the whole file.


I don't play with perl, so I don't have any idea of what you can do.

Anyway, you *must* solve this problem on the server. Forget about
JavaScript to solve it, using JavaScript in this case is bad and wrong =/
--
Jonas Raoni Soares Silva
http://www.jsfromhell.com
Mar 6 '06 #3
jab3 wrote:
[...] That is, my defined function is not being run
when I click stop. I've 'inserted' it like this:
<body onstop="stopped_clicked()">
And the function just grabs the id of the content div, then changes the
innerHTML. Except that's not what happens. :) Nothing happens.
The HTML `body' element does not have an `onstop' attribute (how did
you get that idea anyway?). There is an `onstop' event handler for
the `document' object in the Internet Explorer DOM that "fires when
the user clicks the Stop button or leaves the Web page":

<URL:http://msdn.microsoft.com/workshop/author/dhtml/reference/events/onstop.asp>

However, "There is no public standard that applies to this event." It
is not equally supported in the Gecko DOM, for example. And you cannot
distinguish between the Stop button (or Esc) and "leaving the Web page"
anyway.

When the current browser process is stopped by the user, everything is
supposed to stop, including client-side scripts. What you are trying
to do is like showing an error message with script code in case there
is no script support ;-)
Oh, about the question. I'm trying to determine if the user clicks the
stop button during a post send, basically. [...]


You cannot on the Internet. Observe what happens on your server then
instead, and handle that accordingly.
PointedEars
Mar 6 '06 #4
Jonas Raoni wrote:
jab3 wrote:
Oh, about the question. I'm trying to determine if the user clicks the
stop button during a post send, basically. Specifically, if a user is
uploading a file to my server, and they click stop at some point, I
need to be able to tell the server that stop was clicked, so it doesn't
think that's the whole file.


I don't play with perl, so I don't have any idea of what you can do.

Anyway, you *must* solve this problem on the server. Forget about
JavaScript to solve it, using JavaScript in this case is bad and wrong =/


Yeah, I should've figured as much. I tried matching the Content-Length
header with the actual amount received, but it didn't seem to work.
I'll go back and tinker with it on the server side.

Thanks,
jab3

Mar 6 '06 #5

Thomas 'PointedEars' Lahn wrote:
jab3 wrote:
[...] That is, my defined function is not being run
when I click stop. I've 'inserted' it like this:
<body onstop="stopped_clicked()">
And the function just grabs the id of the content div, then changes the
innerHTML. Except that's not what happens. :) Nothing happens.
The HTML `body' element does not have an `onstop' attribute (how did
you get that idea anyway?). There is an `onstop' event handler for
the `document' object in the Internet Explorer DOM that "fires when
the user clicks the Stop button or leaves the Web page":

<URL:http://msdn.microsoft.com/workshop/author/dhtml/reference/events/onstop.asp>


Um, yeah, not sure how I got the idea that it was a body attribute.
Somewhere I got onload confused with other stuff or something. :) Hey,
I'm new to JavaScript "ova'here". ;)
When the current browser process is stopped by the user, everything is
supposed to stop, including client-side scripts. What you are trying
to do is like showing an error message with script code in case there
is no script support ;-)


HA. After the replies I've gotten, I've realized the absurdity in my
thinking, or lack there of. (shrug) Oh well.
Oh, about the question. I'm trying to determine if the user clicks the
stop button during a post send, basically. [...]


You cannot on the Internet. Observe what happens on your server then
instead, and handle that accordingly.


Aye. That'll be tonight.

Thanks,
jab3

Mar 6 '06 #6
jab3 wrote:
Jonas Raoni wrote:
jab3 wrote:

Yeah, I should've figured as much. I tried matching the Content-Length
header with the actual amount received, but it didn't seem to work.
I'll go back and tinker with it on the server side.


That's it, you should read the http spec, probably the answer is waiting
for you there... There must be a header saying that the transfer failed
or whatever, you just need to discover hehe, good luck :)
--
Jonas Raoni Soares Silva
http://www.jsfromhell.com
Mar 6 '06 #7
jab3 wrote:
Jonas Raoni wrote:
Anyway, you *must* solve this problem on the server. Forget about
JavaScript to solve it, using JavaScript in this case is bad and wrong =/

Not quite true. JavaScript can be server-side. What matters that this
problem cannot be solved _client-side_, no matter the language.
Yeah, I should've figured as much. I tried matching the Content-Length
header with the actual amount received, but it didn't seem to work.
I'll go back and tinker with it on the server side.


That is strange because the value of the Content-Length header in the
request (as evaluated server-side) is supposed to be exactly what you
should compare against. Are you confusing request and response here?
PointedEars
Mar 7 '06 #8

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

8
by: Eric Osman | last post by:
My javascript program has reason to want to stop. For example, function A has 5 lines, the second of which calls function B, which has 5 lines, the first of which calls function C. But...
20
by: Mandy Memphis | last post by:
If I perform a mousedown within a document, move the mouse outside the browser window, and then release the mouse button, the document.onmouseup event does not fire. Is there any way to detect a...
3
by: Dag Sunde | last post by:
Is there a way to detect if the reason an onUnload() handler was called originated from the user explicitly refreshed the page(s)? Ie. pressed "Ctrl-R", "F5" or klicked the refresh button in...
2
by: Martyn Fewtrell | last post by:
Dear All I have a Windows 2003 Server with IIS6 where the validation controls on ASP.Net pages no longer work. I believe it to be specific to the server as if I create an ASP.Net page on the...
4
by: Patrick Flaherty | last post by:
Hi, Experienced programmer but new to PHP. Moreover I'm to use PHP with Xoops on top (this adds object orientation?). I don't seem to find a xoops Usenet group? Whatever the case (and...
79
by: VK | last post by:
I wandering about the common proctice of some UA's producers to spoof the UA string to pretend to be another browser (most often IE). Shouldn't it be considered as a trademark violation of the...
8
by: Richard Maher | last post by:
Hi, I am in a mouseup event for button A and I'd like to disable=false button B before starting some work. Is there anyway that an event for button B can then fire before my event processing for...
4
by: almurph | last post by:
Hi everyone, I'm a newbie to javascript. I have written some code to detect when a user presses the down-arrow, up-arrow and enter button. Essentially the user can arrow down or up through a...
8
praclarush
by: praclarush | last post by:
Ok, I'm new to JavaScript and I'm taking a class for it the assignment in it I'm supposed to create edit a pre-made page to display a marquee that automatically scrolls for the user, as well as give...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.