Browse Source

fixed cors issue with different ports on same host

pull/82/head
TN1ck 8 years ago
parent
commit
7948a8d13c
  1. 9
      resemble.js

9
resemble.js

@ -66,10 +66,11 @@ URL: https://github.com/Huddle/Resemble.js
var errorPixelTransformer = errorPixelTransform.flat; var errorPixelTransformer = errorPixelTransform.flat;
var largeImageThreshold = 1200; var largeImageThreshold = 1200;
var httpRegex = /^https?:\/\//; var httpRegex = /^https?:\/\//;
var document = typeof window != "undefined" ? window.document : {}; var document = typeof window != "undefined" ? window.document : {};
var documentDomainRegex = new RegExp('^https?://' + document.domain); var location = typeof window != "undefined" ? window.location : {};
var documentDomainRegex = new RegExp('^https?://' + location.href.split("/")[2]);
var resemble = function( fileData ){ var resemble = function( fileData ){
@ -151,10 +152,10 @@ URL: https://github.com/Huddle/Resemble.js
hiddenImage.setAttribute('crossorigin', 'anonymous'); hiddenImage.setAttribute('crossorigin', 'anonymous');
hiddenImage.onerror = function () { hiddenImage.onerror = function () {
hiddenImage.onerror = null; //fixes pollution between calls hiddenImage.onerror = null; //fixes pollution between calls
images.push({ error : "Image load error."}); images.push({ error : "Image load error."});
callback(); callback();
}; };
hiddenImage.onload = function() { hiddenImage.onload = function() {

Loading…
Cancel
Save