From a5e87dcedf176cc51b8a7a67cc0e104d8aa3b80d Mon Sep 17 00:00:00 2001 From: Robert Foster Date: Sat, 26 Dec 2015 18:57:24 +1100 Subject: [PATCH] Fix for IE not being able to install packages in Umbraco backoffice. --- src/Umbraco.Web.UI/umbraco/ClientRedirect.aspx | 5 +++++ src/Umbraco.Web.UI/umbraco/developer/Packages/proxy.htm | 5 +++++ 2 files changed, 10 insertions(+) diff --git a/src/Umbraco.Web.UI/umbraco/ClientRedirect.aspx b/src/Umbraco.Web.UI/umbraco/ClientRedirect.aspx index 6f0bd7c008..2a10d4d344 100644 --- a/src/Umbraco.Web.UI/umbraco/ClientRedirect.aspx +++ b/src/Umbraco.Web.UI/umbraco/ClientRedirect.aspx @@ -22,6 +22,11 @@ var parser = document.createElement('a'); parser.href = parts[1]; + // This next line may seem redundant but is required to get around a bug in IE + // that doesn't set the parser.hostname or parser.protocol correctly for relative URLs. + // See https://gist.github.com/jlong/2428561#gistcomment-1461205 + parser.href = parser.href; + // => "http:" if (!parser.protocol || (parser.protocol.toLowerCase() !== "http:" && parser.protocol.toLowerCase() !== "https:")) { throw "invalid protocol"; diff --git a/src/Umbraco.Web.UI/umbraco/developer/Packages/proxy.htm b/src/Umbraco.Web.UI/umbraco/developer/Packages/proxy.htm index 8a3de035bb..43aef0ab96 100644 --- a/src/Umbraco.Web.UI/umbraco/developer/Packages/proxy.htm +++ b/src/Umbraco.Web.UI/umbraco/developer/Packages/proxy.htm @@ -15,6 +15,11 @@ var parser = document.createElement('a'); parser.href = window.location.search.substring(1); + // This next line may seem redundant but is required to get around a bug in IE + // that doesn't set the parser.hostname or parser.protocol correctly for relative URLs. + // see https://gist.github.com/jlong/2428561#gistcomment-1461205 + parser.href = parser.href; + // => "http:" if (parser.protocol && (parser.protocol.toLowerCase() != "http:" && parser.protocol.toLowerCase() != "https:")) { throw "invalid protocol";