我如何可以调用浏览器退出(ESC)功能 [英] How I can call the browser escape (esc) function

查看:240
本文介绍了我如何可以调用浏览器退出(ESC)功能的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我如何可以调用函数ESC这种方法,停止页面加载,使用jQuery。
这是有一些API调用或别的东西。
任何人的想法?

编辑:

我要取消表单提交。

我现在使用的是什么:

  window.stop();

感谢


解决方案

 的$(document).keydown(函数(五){
  如果(e.which == 27){// ESC
    window.stop();
  }
});

https://developer.mozilla.org/en-美国/文档/网络/ API / window.stop


  

在stop()方法是完全等同于点击浏览器的停止按钮。因为在哪些脚本加载,stop()方法不能停止在它被加载包含的文件,但它会停止大量的图片,新的窗口和其他对象的加载延迟的加载顺序

<大骨节病> 操场

How I can call this method of the esc function, to stop page loading, with jquery. This is there some api call or something else. Anyone an idea?

EDIT:

I want to cancel a form submission.

What I am using now:

window.stop();

Thanks

解决方案

$(document).keydown(function(e) {
  if (e.which== 27) {  // ESC
    window.stop();
  }   
});

https://developer.mozilla.org/en-US/docs/Web/API/window.stop

The stop() method is exactly equivalent to clicking the stop button in the browser. Because of the order in which scripts are loaded, the stop() method cannot stop the document in which it is contained from loading, but it will stop the loading of large images, new windows, and other objects whose loading is deferred.

PLAYGROUND

这篇关于我如何可以调用浏览器退出(ESC)功能的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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