当用户点击UI上的任何按钮时,我想停止浏览器请求,例如浏览器上的停止按钮 [英] I want to stop the browser request, when user clicks on any button from UI, like stop button on browser

查看:100
本文介绍了当用户点击UI上的任何按钮时,我想停止浏览器请求,例如浏览器上的停止按钮的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当用户点击来自UI的任何按钮时,我想停止浏览器请求,例如浏览器上的停止按钮。我想通过javascript来做。

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.

推荐答案

你可以尝试一些事情......我看了一下论坛

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

以下内容..

在Netscape中, window.stop()似乎工作(与我猜的浏览器上的停止按钮相同)。但是,这在IE中不起作用。

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.


我不认为你可以在IE中停止处理,但你可以尝试一个
以下内容:

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

Event.cancelBubble这只是IE并停止EVENT传播。
但是,一旦事件发生(onSubmit,onClick或你用来开始下载的
),我不确定这会阻止它。

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。 Reason保存代码的值,指定
数据传输的状态。 0 =成功,1 =中止,2 =错误。我
不记得这是否是readonly。如果不是,也许你可以
指定一个值来中止转移。

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。我会引用这个。 '如果returnValue设置为
,则其值优先于
事件处理程序实际接收的值。将此属性设置为false可取消发生事件的sourece元素的默认操作
。'

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(停止);

document.execCommand("Stop");

这适用于IE。

这篇关于当用户点击UI上的任何按钮时,我想停止浏览器请求,例如浏览器上的停止按钮的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆