Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Preventing ESC from cancelling active XmlHttpRequests

83 views
Skip to first unread message

cerihughes

unread,
Apr 16, 2009, 9:19:53 AM4/16/09
to

I've noticed that pressing "ESC" while Firefox's javascript engine is
executing a XmlHttpRequest causes that request to abort.

I have an interesting problem where I have some code that executes
after the ESC key has been pressed. Part of this code sets up and
executes a XmlHttpRequest, resulting in the following exception being
generated:

Component returned failure code: 0x80004005 (NS_ERROR_FAILURE)
[nsIXMLHttpRequest.send]

The escape key is being handled both by my javascript code (which sets
up the xhr), then the browser (which immediately aborts it).

Is there any way to prevent this key stroke from being processed by
the browser? I've tried all mechanisms that prevent the event from
propagating further (event.preventDefault() and event.stopPropagation
() don't work) but none of these seem to stop it from reaching the
browser.

Thanks,

Cer

Tei

unread,
Apr 16, 2009, 11:12:05 AM4/16/09
to dev-tech-...@lists.mozilla.org
Removing control from the user is evil and a NO NO. What If the user is a
customer that want to stop a credit card buy?

Have you tried creating something like a 2th context? maybe inside a iframe,
or a hidden popup, or something. I guest the ESC command stop the active
page, but not childrens of that page.. or sisters of that page (a different
frame, in a frame based page)


--
--
ℱin del ℳensaje.

cerihughes

unread,
Apr 17, 2009, 3:52:57 AM4/17/09
to
I agree about taking control away from the user being bad, but in this
case it doesn't apply. The javascript we're writing will be deployed
onto a non-PC device running an embedded browser that doesn't give the
user the ability to navigate anywhere other than our app. On our
target device, the ESC problem doesn't manifest itself, but we're
using Firefox as our dev environment (thanks to Firebug and other
useful dev plugins), and we're finding that the app doesn't run
correctly due to the ESC problem.

It's not a HUGE problem... We can live with it for development
purposes. I was just wondering if there was a way of switching off
that feature without having to rebuild it from source.

0 new messages