blob: d99dc5f6fb167ce49c5b2f5ede45c7cd39b5bccd (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
|
<html><head><title></title></head><body>
<script type="text/javascript">
function handleProtocol(url) {
if ({% if isHttps %}true{% else %}false{% endif %}) {
return url.replace(/http:\/\//i, "https://");
} else {
return url.replace(/https:\/\//i, "http://");
}
}
if (window.location.hash) {
var match = false;
var parser = document.createElement('a');
var urlToRedirect = window.location.hash.substr(1);
parser.href = urlToRedirect;
var hostToRedirect = parser.hostname;
var knownUrls = {{ knownUrls|raw }};
for (var i = 0; i < knownUrls.length; i++) {
parser.href = knownUrls[i];
var testHost = parser.hostname;
if (hostToRedirect === testHost && testHost) {
match = true;
if (navigator.appName == "Microsoft Internet Explorer") {
// internet explorer loses the referrer if we use window.location.href=X
var referLink = document.createElement("a");
referLink.href = handleProtocol(urlToRedirect);
document.body.appendChild(referLink);
referLink.click();
} else {
window.location.href = handleProtocol(urlToRedirect);
}
break;
}
}
if (!match) {
var idSite = window.location.href.match(/idSite=([0-9]+)/i)[1];
window.location.href = "index.php?module=Overlay&action=showErrorWrongDomain"
+ "&idSite=" + idSite
+ "&url=" + encodeURIComponent(urlToRedirect);
}
}
else {
window.location.href = handleProtocol("{{ mainUrl|e('js') }}");
};
</script>
</body></html>
|