Hidden/invisible Ajax request?(隐藏/不可见的 Ajax 请求?)
问题描述
是否可以编写和创建无法被 Firefox 中的 Firebug 插件捕获的 JavaScript Ajax 请求?
Is it possible to write and create a JavaScript Ajax request witch cannot be catched by the Firebug plugin in Firefox?
我问这个是因为我可以在 Facebook 上看到没有 Ajax 请求正在进行,但是当我从另一个帐户发送消息时,顶部的消息框会添加1 条未读消息"指示器...这怎么可能实现?
I'm asking this because I can see on Facebook that there are no Ajax request going on, but still when I sent a message from another Account, the message box on the top will add the "1 unread message" indicator... How's even this possible to achive?
谢谢.
推荐答案
Firebug 将标准"AJAX 请求记录到控制台面板;这些是使用 ActiveX/XHR 发起的请求.
Firebug logs "standard" AJAX requests to the Console panel; these are requests initiated using ActiveX/XHR.
不过,其他类型的请求也在发生 - CSS 加载、图像、javascript 等.这些请求记录在 Firebug 的网络面板中.另请注意,在控制台中记录的请求也出现在网络中.
Other types of requests are happening, though - CSS loading, images, javascript, etc. These requests are logged in Firebug's Net panel. Note also that requests logged in Console also appear in Net.
JSONP 是 AJAX 的一种跨域方法,其中将 <script>
标签添加到页面.当请求完成时,脚本标签的加载内容被解析为 JSON.这样做的原因是您欺骗"您的浏览器将请求视为对 javascript 资源的请求而不是 AJAX 请求,从而绕过跨浏览器的安全限制.
JSONP is a cross-domain method of AJAX in which a <script>
tag is added to the page. When the request completes, the loaded contents of the script tag are parsed as JSON. The reason this works is that you are "tricking" your browser into treating the request as a request for a javascript resource rather than an AJAX request, thus skirting cross-browser security restrictions.
综上所述,JSONP 请求(以及所有其他类型的请求,在 这里 以及所有 <iframe>
请求)都记录在网络面板上,而不是控制台面板上.这不是错误或问题.理解 JSONP 的工作方式,请求只会出现在网络中是合乎逻辑的.
Putting this all together, JSONP requests (as well as all other types of requests, listed here as well as all <iframe>
requests) are logged on the Net panel rather than in the Console panel. This isn't a bug or a problem; understanding the way JSONP works it is logical that the request would only appear in Net.
这篇关于隐藏/不可见的 Ajax 请求?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
本文标题为:隐藏/不可见的 Ajax 请求?
基础教程推荐
- 角度Apollo设置WatchQuery结果为可用变量 2022-01-01
- 在for循环中使用setTimeout 2022-01-01
- 动态更新多个选择框 2022-01-01
- 当用户滚动离开时如何暂停 youtube 嵌入 2022-01-01
- Karma-Jasmine:如何正确监视 Modal? 2022-01-01
- 在 JS 中获取客户端时区(不是 GMT 偏移量) 2022-01-01
- 悬停时滑动输入并停留几秒钟 2022-01-01
- 响应更改 div 大小保持纵横比 2022-01-01
- 有没有办法使用OpenLayers更改OpenStreetMap中某些要素 2022-09-06
- 我什么时候应该在导入时使用方括号 2022-01-01