What is $httpProvider.defaults.headers.common in native JavaScript syntax -


how set common request header using javascript every single http call client side?

i don't think there native support this. on other hand can extend xmlhttprequest class passes custom header , override existing xmlhttprequest in window.

take @ answer : https://stackoverflow.com/a/9701050

sample:

!(send){     xmlhttprequest.prototype.send = function (data) {         this.setrequestheader("x-requested-with", "xmlhttprequest"); // set header here         send.call(this, data);     } }(xmlhttprequest.prototype.send); 

Comments

Popular posts from this blog

get url and add instance to a model with prefilled foreign key :django admin -

css - Make div keyboard-scrollable in jQuery Mobile? -

ruby on rails - Seeing duplicate requests handled with Unicorn -