trreeves / superagent-legacyiesupport Goto Github PK
View Code? Open in Web Editor NEWA plugin for the Superagent Javascript library to support cross domain requests on IE 8 & 9
License: MIT License
A plugin for the Superagent Javascript library to support cross domain requests on IE 8 & 9
License: MIT License
I've noticed that superagent-legacyIESupport.js has been saved as UTF-8 with BOM. (byte order marker)
When I build my project with Webpack (without minification enabled) the script throws an error "Invalid or unexpected token" at the start of the superagent-legacyIESupport bundle.
Note: this does not happen when Webpack minification is enabled as the minification strips out all unnecessary whitespace.
I encountered a problem when making a cross-domain POST in IE9 when one of the query parameters in an Object. The request looks like:
request
.post('remote-url')
.send({
string: 'foo',
number: 10,
object: { someProp: true }
})
.use(superagent-legacyIESupport)
The resulting request looks like string=foo&number=10&object=%5Bobject%20Object%5D
.
I'll submit a pull request with the changes I made to fix this.
Thanks for this great superagent plugin!
I had trouble getting a CORS POST to work in IE10 until I disabled this plugin. No Content-Type
was sent so the server errored with 415 Unsupported Media Type
. I started looking through the plugin code to investigate.
I see several mentions of shimming IE8 and IE9, but is this plugin also meant to affect IE10? That version seems to support CORS with XMLHttpRequest
.
Browser/OS | "withCredentials" in (new XMLHttpRequest()) |
---|---|
IE 8 / Win7 | ❌ |
IE 9 / Win7 | ❌ |
IE 10 / Win7 | ✅ |
IE 10 / Win8 | ✅ |
IE 11 / Win7 | ✅ |
Should the check for typeof XDomainRequest !== "undefined"
be amended to typeof XDomainRequest !== "undefined" && !("withCredentials" in (new XMLHttpRequest()))
?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.