Chrome開發者工具裡的一個隱藏技能:chrome://net-internals
During my holiday I was writing a small tool for fun, which extracts my personal posts from http://www. 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 開發者工具 workspace 的概念Chrome
- chrome開發者工具 - 00 概述Chrome
- 深入探索Chrome開發者工具:開發者的利器Chrome
- Chrome 開發者工具 Performances 皮膚裡的引數解讀ChromeORM
- Chrome開發者工具Debug入門Chrome
- Chrome 72 開發者工具新特性Chrome
- Chrome 77 開發者工具新特性Chrome
- Google Chrome 開發者工具漏洞利用GoChrome
- Jerry和您聊聊Chrome開發者工具Chrome
- 使用Chrome開發者工具研究JavaScript裡函式的原生實現ChromeJavaScript函式
- [譯] Chrome 73 開發者工具新特性Chrome
- chrome開發者工具各種騷技巧Chrome
- Chrome 自帶開發者工具筆記Chrome筆記
- 使用Chrome 開發者工具提取對應的字串Chrome字串
- Chrome 開發者工具 performance 標籤頁的用法ChromeORM
- 什麼是 Chrome 開發者工具 performance 皮膚 Experience 裡的 Layout shiftChromeORM
- chrome開發者模式怎麼開啟 chrome開發者模式在哪開啟Chrome模式
- Selenium系列教程-02 使用Chrome開發者工具Chrome
- Chrome開發者工具中Elements(元素)斷點的用途Chrome斷點
- chrome 開發者工具——前端實用功能總結Chrome前端
- Chrome 開發者工具 network 標籤頁裡獲取到的 cookie 欄位在 Postman 裡的應用ChromeCookiePostman
- 十款開發者常用的Chrome外掛,讓chrome成為開發利器!Chrome
- 開發者工具的新特性 (Chrome 71) [雙語+視訊]Chrome
- 使用Chrome開發者工具研究JavaScript的垃圾回收機制ChromeJavaScript
- chrome開發者工具使用教程-02-console皮膚Chrome
- chrome 開發者工具使用教程-01-element皮膚Chrome
- 使用 Chrome 開發者工具分析記憶體問題Chrome記憶體
- Chrome 開發者工具裡 JavaScript 檔名後面跟的 'eval' 是什麼含義ChromeJavaScript
- 開發者工具又加了什麼好東西?(Chrome 68)Chrome
- Chrome 開發者工具 network 顯示 Provisional headers are shown 的幾種原因ChromeHeader
- Chrome開發者工具不完全指南(四、效能進階篇)Chrome
- 使用chrome開發者工具中的performance皮膚解決效能瓶頸ChromeORM
- 從 0 開始入門 Chrome Ext 安全(一) -- 瞭解一個 Chrome ExtChrome
- 在 Chrome 開發者工具裡透過 network 選項模擬網站的離線訪問模式Chrome網站模式