Coder Social home page Coder Social logo

superagent-legacyiesupport's Introduction

superagent-legacyIESupport

A plugin for the Superagent Javascript library to support cross domain requests on IE 8 & 9. Now on npm : https://www.npmjs.com/package/superagent-legacyiesupport.

Description

Surprise surprise, CORS requests don't work quite the same way in IE 8 & 9 as they do in other browsers, and they come with some extra restrictions. This is a nice page describing some of the finer details: http://blogs.msdn.com/b/ieinternals/archive/2010/05/13/xdomainrequest-restrictions-limitations-and-workarounds.aspx.

In a nutshell, CORS is implemented with its own XDomainRequest object, seperate from XMLHTTPRequest. As a bonus, it doesn't support sending cookies, at all, or custom headers, or any verbs other than GET and POST, and requests must be made to the same scheme as the current page.

Superagent out of the box does support making requests in IE 8 & 9 to origins on the same domain (which doesn't include sub domains by the way), and does support cross domain requests with CORS-supporting services on the other major browsers, including IE 10 & 11.

However, you'll need to do something similar to what this plugin does if you want to make cross domain requests on IE 8 & 9.

Also bear in mind, if you want to do any cross domain requests from any version of IE, your service will also need to supply a valid P3P header for IE to honour the response.

Have fun.

Usage

var request = require('superagent'),
    legacyIESupport = require('./superagent-legacyIESupport');

request
   .get(...)
   .use(legacyIESupport)
   .withCredentials() // this will be ignored if on IE 8 & 9
   .end(...);

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.