拦截传出的浏览器HTTP请求 [英] Intercept outgoing browser HTTP requests

查看:707
本文介绍了拦截传出的浏览器HTTP请求的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个Web应用程序.我的应用程序是否可以监视源自我的应用程序的所有传出客户端浏览器HTTP请求?如果是,是否有可能拦截它们并随意取消它们?特别是是否有JQuery HTTP拦截器?

I have a web application. Is it possible for my app to monitor all outgoing client browser HTTP requests that originate from my app? If it is, is it possible to intercept them and cancel them at will? Is there a JQuery HTTP interceptor, in particular?

推荐答案

使用ajaxSetup.beforeSend

This is possible with JQuery using ajaxSetup.beforeSend

$.ajaxSetup({
  beforeSend: function(xhr) {
      //do your stuff here
  }
});

这篇关于拦截传出的浏览器HTTP请求的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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