Firefox add-on SDK: Get http response headers

前端 未结 1 434
闹比i
闹比i 2020-12-10 08:10

I\'m new to add-on development and I\'ve been struggling with this issue for a while now. There are some questions here that are somehow related but they haven\'t helped me

相关标签:
1条回答
  • 2020-12-10 08:25

    You're pretty much there, take a look at the sample code here for more things you can do.

      onExamineResponse: function (oHttp)
      {  
            try
           {
             var header_value = oHttp.getResponseHeader("<the_header_that_i_need>"); 
             // URI is the nsIURI of the response you're looking at 
             // and spec gives you the full URL string
             var url = oHttp.URI.spec;
           }
           catch(err)
           {
             console.log(err);
           }
       }
    

    Also people often need to find the tab related, which this answers Finding the tab that fired an http-on-examine-response event

    0 讨论(0)
提交回复
热议问题