Hidden/invisible Ajax request?

只谈情不闲聊 提交于 2019-12-20 02:36:06

问题


Is it possible to write and create a JavaScript Ajax request witch cannot be catched by the Firebug plugin in Firefox?

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?

Thanks.


回答1:


Firebug logs "standard" AJAX requests to the Console panel; these are requests initiated using ActiveX/XHR.

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 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.

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.




回答2:


When using jsonp as your data type your calls do not show up in Firebug.



来源:https://stackoverflow.com/questions/8138989/hidden-invisible-ajax-request

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!