Fix origin check for IE (#460)

This commit is contained in:
Niklas von Hertzen 2014-10-07 18:59:26 +03:00
parent e103ad8219
commit 6073928978
3 changed files with 14 additions and 8 deletions

9
dist/html2canvas.js vendored
View File

@ -935,7 +935,7 @@ function ImageLoader(options, support) {
this.link = null;
this.options = options;
this.support = support;
this.origin = window.location.protocol + window.location.hostname + window.location.port;
this.origin = this.getOrigin(window.location.href);
}
ImageLoader.prototype.findImages = function(nodes) {
@ -1019,11 +1019,14 @@ ImageLoader.prototype.imageExists = function(images, src) {
};
ImageLoader.prototype.isSameOrigin = function(url) {
return (this.getOrigin(url) === this.origin);
};
ImageLoader.prototype.getOrigin = function(url) {
var link = this.link || (this.link = document.createElement("a"));
link.href = url;
link.href = link.href; // IE9, LOL! - http://jsfiddle.net/niklasvh/2e48b/
var origin = link.protocol + link.hostname + link.port;
return (origin === this.origin);
return link.protocol + link.hostname + link.port;
};
ImageLoader.prototype.getPromise = function(container) {

File diff suppressed because one or more lines are too long

View File

@ -2,7 +2,7 @@ function ImageLoader(options, support) {
this.link = null;
this.options = options;
this.support = support;
this.origin = window.location.protocol + window.location.hostname + window.location.port;
this.origin = this.getOrigin(window.location.href);
}
ImageLoader.prototype.findImages = function(nodes) {
@ -86,11 +86,14 @@ ImageLoader.prototype.imageExists = function(images, src) {
};
ImageLoader.prototype.isSameOrigin = function(url) {
return (this.getOrigin(url) === this.origin);
};
ImageLoader.prototype.getOrigin = function(url) {
var link = this.link || (this.link = document.createElement("a"));
link.href = url;
link.href = link.href; // IE9, LOL! - http://jsfiddle.net/niklasvh/2e48b/
var origin = link.protocol + link.hostname + link.port;
return (origin === this.origin);
return link.protocol + link.hostname + link.port;
};
ImageLoader.prototype.getPromise = function(container) {