Mannusanghi Mannusanghi - 7 months ago 18
Javascript Question

I want to stop the browser request, when user clicks on any button from UI, like stop button on browser

I want to stop the browser request, when user clicks on any button from UI, like stop button on browser. I want to do it through javascript.

Answer

You can try a few things .. I looked at a forum here

followings from that ..

In Netscape, window.stop() seems to work (in the same way as the Stop button on the browser I guess). However, this does not work in IE.

I don't think you can stop the processing in IE, but you might try one of the following:

Event.cancelBubble this is IE only and stops EVENT propogation. However, once the event has occurred (onSubmit, onClick or whatever you used to start the download), I'm not sure this will stop it.

Event.reason IE only. Reason holds the value of the code specifying the status of the data transfer. 0=successful, 1=aborted, 2=error. I don't remember if this is readonly. If it is not, perhaps you can assign a value of 1 to abort the transfer.

Event.returnValue IE only. I'll quote this one. 'If returnValue is set, its value takes precedent over the value actually received by an event handler. Set this property to false to cancel the default action fo the sourece element on which the event occured.'

Play with these a bit. I don't see anything else that might work. If they don't do anything to stop the process, it probably can't be done.

I found a way to do this after a lot of research - use

document.execCommand("Stop");

This works in IE.