forked from Exodus-Privacy/website
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
trying to fix issue Exodus-Privacy#200
- Loading branch information
Showing
1 changed file
with
63 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
<!DOCTYPE html> | ||
<html> | ||
<head> | ||
<title>{{ .Permalink }}</title> | ||
<link rel="canonical" href="{{ .Permalink }}"/> | ||
<meta name="robots" content="noindex"> | ||
<meta charset="utf-8"/> | ||
<noscript> | ||
<meta http-equiv="refresh" content="0; url={{ .Permalink }}"/> | ||
</noscript> | ||
<script> | ||
;(function () { | ||
// Only do i18n at root, | ||
// otherwise, redirect immediately | ||
if (window.location.pathname !== '/') { | ||
window.location.replace('{{ .Permalink }}') | ||
return | ||
} | ||
|
||
var getFirstBrowserLanguage = function () { | ||
var nav = window.navigator, | ||
browserLanguagePropertyKeys = ['language', 'browserLanguage', 'systemLanguage', 'userLanguage'], | ||
i, | ||
language | ||
|
||
if (Array.isArray(nav.languages)) { | ||
for (i = 0; i < nav.languages.length; i++) { | ||
language = nav.languages[i] | ||
if (language && language.length) { | ||
return language | ||
} | ||
} | ||
} | ||
|
||
// support for other well known properties in browsers | ||
for (i = 0; i < browserLanguagePropertyKeys.length; i++) { | ||
language = nav[browserLanguagePropertyKeys[i]] | ||
if (language && language.length) { | ||
return language | ||
} | ||
} | ||
return 'en' | ||
} | ||
|
||
var preferLang = getFirstBrowserLanguage() | ||
if (preferLang.indexOf('fr') !== -1) { | ||
// visitor prefers French | ||
window.location.replace('/fr/') | ||
} else if (preferLang.indexOf('ru') !== -1) { | ||
// visitor prefers Russian | ||
window.location.replace('/ru/') | ||
} else { | ||
// default to English | ||
window.location.replace('/en/') | ||
} | ||
})() | ||
</script> | ||
</head> | ||
<body> | ||
<h1>Rerouting</h1> | ||
<p>You should be rerouted in a jiff, if not, <a href="{{ .Permalink }}">click here</a>.</p> | ||
</body> | ||
</html> |