Chrome開發者工具裡的一個隱藏技能:chrome://net-internals
During my holiday I was writing a small tool for fun, which extracts my personal posts from baidu.com for further analysis. I am using AJAX in jQuery to perform a synchronous call to fetch html source code of given url specified by argument requestURL.、
function getPostByAJAX(requestURL){
var html = $.ajax({
url: requestURL,
async: false}).responseText;
return html;}
The requestURL I am using is http:// tieba.baidu.com/i/i/my_ tie
However when I try to access it via my JavaScript code above, it failed. And Chrome development tool didn’t give me enough information for trouble shooting.
How to deal with this issue then? Then I found the useful tool from Google: chrome://net-internals Now let’s continue to trouble shoot with this tool.
(1) type chrome://net-internals in Chrome address bar, press enter key. Then click Event hyperlink.
(2) Go to my own html page which will send AJAX request via jQuery, click F5 to send a new request, then go back to Chrome tool. Now I have found the trace entry for the sent request. Here below is the request detail which contains much more information compared with the one in Chrome development Tool-Network tab.
And here below are response header fields:
The return code 302 and location “ http:// static.tieba.baidu.com/ tb/error.html?ErrType=1 ” give me a reminder that this issue might be related to logon state of BAIDU website, since I would like to return my personal information, it makes sense that the url can only return personal data if cookie is available or user credential is specified ( not supported by BAIDU in this case ). In order to verify my assumption, I request the url directly in Chrome and check its request header fields this time, and yes, the cookie field is there:
So now the question is, how to send my cookie information together with the AJAX call in JavaScript code? I found this article from Google. According to the article, I add the following code in my function:
And it works now:
By the way, via this tool I can also figure out how the jQuery library file jquery1.7.1.js stored in local laptop is loaded by Chrome. Chrome reads this file by chunks with size 32768 ( the file consists of 8 chunks ).
The total size 251661 matches exactly with the number I see in windows, perfect isn’t it?
Further reading
For more tips I gained during my daily work about Chrome development tools, please refer to this blog Chrome Development Tool tips used in my daily work.
要獲取更多Jerry的原創文章,請關注公眾號"汪子熙":
來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/24475491/viewspace-2703942/,如需轉載,請註明出處,否則將追究法律責任。
相關文章
- Chrome開發者工具關於網路請求的一個隱藏技能Chrome
- Chrome 開發者工具裡的 CSS grid editorChromeCSS
- chrome開發者工具Chrome
- chrome開發者工具的使用Chrome
- Chrome 開發者工具的技巧Chrome
- chrome開發者工具使用Chrome
- Chrome 開發者工具 workspace 的概念Chrome
- Chrome開發者工具的小技巧Chrome
- 深入探索Chrome開發者工具:開發者的利器Chrome
- chrome開發者工具 - 00 概述Chrome
- chrome 開發者工具使用技巧Chrome
- Chrome 開發者工具 Performances 皮膚裡的引數解讀ChromeORM
- 使用Chrome開發者工具研究JavaScript裡函式的原生實現ChromeJavaScript函式
- Google Chrome 開發者工具漏洞利用GoChrome
- Chrome 72 開發者工具新特性Chrome
- Chrome 77 開發者工具新特性Chrome
- Jerry和您聊聊Chrome開發者工具Chrome
- 用Chrome開發者工具除錯一切Chrome除錯
- Chrome 開發者工具的小技巧總結Chrome
- 什麼是 Chrome 開發者工具 performance 皮膚 Experience 裡的 Layout shiftChromeORM
- Chrome 自帶開發者工具筆記Chrome筆記
- Chrome開發者工具Debug入門Chrome
- [譯] Chrome 73 開發者工具新特性Chrome
- chrome開發者工具各種騷技巧Chrome
- Chrome 開發者工具 performance 標籤頁的用法ChromeORM
- 如何更專業的使用Chrome開發者工具Chrome
- 使用Chrome 開發者工具提取對應的字串Chrome字串
- 你所不知道的10個“Chrome開發者工具”使用技巧Chrome
- Chrome的隱身模式Chrome模式
- Chrome 66 開發者工具新特性介紹Chrome
- Chrome開發者工具中Elements(元素)斷點的用途Chrome斷點
- Chrome 開發者工具 network 標籤頁裡獲取到的 cookie 欄位在 Postman 裡的應用ChromeCookiePostman
- 15個必須知道的chrome開發者技巧Chrome
- Chrome開發者工具不完全指南(一、基礎功能篇)Chrome
- Chrome 開發者工具裡 JavaScript 檔名後面跟的 'eval' 是什麼含義ChromeJavaScript
- chrome 開發者工具——前端實用功能總結Chrome前端
- Selenium系列教程-02 使用Chrome開發者工具Chrome
- Chrome開發者工具詳解(4):Profiles皮膚Chrome