温馨提示×

温馨提示×

您好,登录后才能下订单哦!

密码登录×
登录注册×
其他方式登录
点击 登录注册 即表示同意《亿速云用户服务条款》

Chrome开发者工具里的一个隐藏技能:chrome://net-internals

发布时间:2020-08-07 19:18:08 来源:ITPUB博客 阅读:193 作者:i042416 栏目:web开发

During my holiday I was writing a small tool for fun, which extracts my personal posts from  http://www.  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:// tie http:// 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:


Chrome开发者工具里的一个隐藏技能:chrome://net-internals


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:


Chrome开发者工具里的一个隐藏技能:chrome://net-internals


And it works now:


Chrome开发者工具里的一个隐藏技能:chrome://net-internals


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


Chrome开发者工具里的一个隐藏技能:chrome://net-internals


The total size 251661 matches exactly with the number I see in windows, perfect isn’t it?


Chrome开发者工具里的一个隐藏技能:chrome://net-internals


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的原创文章,请关注公众号"汪子熙":

Chrome开发者工具里的一个隐藏技能:chrome://net-internals

向AI问一下细节

免责声明:本站发布的内容(图片、视频和文字)以原创、转载和分享为主,文章观点不代表本网站立场,如果涉及侵权请联系站长邮箱:is@yisu.com进行举报,并提供相关证据,一经查实,将立刻删除涉嫌侵权内容。

AI