Skip to content

Instantly share code, notes, and snippets.

View warpech's full-sized avatar
🤹‍♂️
Code sweet code

Marcin Warpechowski warpech

🤹‍♂️
Code sweet code
View GitHub Profile
@warpech
warpech / jquery.xdomain.js
Created December 15, 2011 16:10 — forked from mathieucarbou/jquery.xdomain.js
jQuery CORS Plugin - transparently add CORS support for IE8+ in jQuery using XDomainRequest. Support cookies.
(function($) {
var urlParseRE = /^(((([^:\/#\?]+:)?(?:\/\/((?:(([^:@\/#\?]+)(?:\:([^:@\/#\?]+))?)@)?(([^:\/#\?]+)(?:\:([0-9]+))?))?)?)?((\/?(?:[^\/\?#]+\/+)*)([^\?#]*)))?(\?[^#]+)?)(#.*)?/;
function parseUrl(url) {
if (typeof url === "object") {
return url;
}
var u = url || "", matches = urlParseRE.exec(url), results;
if (matches) {
results = {