$http doesn’t send cookie in Requests

In your config, DI $httpProvider and then set withCredentials to true: .config(function ($httpProvider) { $httpProvider.defaults.withCredentials = true; //rest of route code }) Info on angularjs withCredentials: http://docs.angularjs.org/api/ng.$http Which links to the mozilla article: https://developer.mozilla.org/en-US/docs/HTTP/Access_control_CORS?redirectlocale=en-US&redirectslug=HTTP_access_control#section_5

Persistent Service Worker in Chrome Extension

Service worker (SW) can’t be persistent by definition and the browser must forcibly terminate all of SW connections such as network requests or runtime ports after a certain time, which in Chrome is 5 minutes. The inactivity timer when no such requests or ports are open is even shorter: 30 seconds. Chromium team currently considers … Read more

Web Scraping in a Google Chrome Extension (JavaScript + Chrome APIs)

Attempt to use XHR2 responseType = “document” and fall back on (new DOMParser).parseFromString(responseText, getResponseHeader(“Content-Type”)) with my text/html patch. See https://gist.github.com/1138724 for an example of how I detect responseType = “document support (synchronously checking response === null on an object URL created from a text/html blob). Use the Chrome WebRequest API to hide X-Requested-With, etc. headers.

How to Detect Cross Origin (CORS) Error vs. Other Types of Errors for XMLHttpRequest() in Javascript

No, there is no way to tell the difference, according the W3C Spec. Here’s how the CORS specification specifies the simple cross-origin request procedure: Apply the make a request steps and observe the request rules below while making the request. If the manual redirect flag is unset and the response has an HTTP status code … Read more

Timeout feature in the axios library is not working

From this axios issue (Thanks to zhuyifan2013 for giving the solution), I’ve found that axios timeout is response timeout not connection timeout. Let say you’ve requested the URL through axios and server is taking long time to respond, in this case the axios timeout will work. But you don’t have internet connection or the IP … Read more

How do I get the HTTP status code with jQuery?

this is possible with jQuery $.ajax() method $.ajax(serverUrl, { type: OutageViewModel.Id() == 0 ? “POST” : “PUT”, data: dataToSave, statusCode: { 200: function (response) { alert(‘1’); AfterSavedAll(); }, 201: function (response) { alert(‘1’); AfterSavedAll(); }, 400: function (response) { alert(‘1’); bootbox.alert(‘<span style=”color:Red;”>Error While Saving Outage Entry Please Check</span>’, function () { }); }, 404: function … Read more

A CORS POST request works from plain JavaScript, but why not with jQuery?

UPDATE: As TimK pointed out, this isn’t needed with jquery 1.5.2 any more. But if you want to add custom headers or allow the use of credentials (username, password, or cookies, etc), read on. I think I found the answer! (4 hours and a lot of cursing later) //This does not work!! Access-Control-Allow-Headers: * You … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)