Fixes: U4-5252

This commit is contained in:
Shannon
2014-07-23 04:10:48 +10:00
parent 626e155c07
commit e98ed8561a

View File

@@ -1,4 +1,4 @@
<%@ Page Language="C#" AutoEventWireup="true" Inherits="System.Web.UI.Page" %>
<%@ Page Language="C#" AutoEventWireup="true" Inherits="Umbraco.Web.UI.Pages.UmbracoEnsuredPage" %>
<%--
This page is required because we cannot reload the angular app with a changed Hash since it just detects the hash and doesn't reload.
So this is used purely for a full reload of an angular app with a changed hash.
@@ -8,12 +8,46 @@
<head runat="server">
<title>Redirecting...</title>
<script type="text/javascript">
var parts = window.location.href.split("?redirectUrl=");
if (parts.length != 2) {
window.location.href = "/";
}
else {
window.location.href = parts[1];
//This is a genius way of parsing a uri
//https://gist.github.com/jlong/2428561
try {
var parser = document.createElement('a');
parser.href = parts[1];
// => "http:"
if (!parser.protocol || (parser.protocol.toLowerCase() != "http:" && parser.protocol.toLowerCase() != "https:")) {
throw "invalid protocol";
};
// => "example.com"
if (!parser.hostname || parser.hostname == "") {
throw "invalid hostname";
}
//parser.port; // => "3000"
//parser.pathname => "/pathname/"
//parser.search => "?search=test"
// => "#hash"
if (parser.hash && parser.hash.indexOf("#/developer/framed/") != 0) {
throw "invalid hash";
}
//parser.host; // => "example.com:3000"
window.location.href = parts[1];
} catch (e) {
alert(e);
}
}
</script>
</head>