summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--static/index.html2
-rw-r--r--static/redirect.js11
2 files changed, 10 insertions, 3 deletions
diff --git a/static/index.html b/static/index.html
index 66af1a72..e8e325d1 100644
--- a/static/index.html
+++ b/static/index.html
@@ -114,6 +114,6 @@
<li><a href="https://reddit.com/r/GrapheneOS">Reddit</a></li>
</ul>
</footer>
- <script src="/redirect.js?0"></script>
+ <script src="/redirect.js?1"></script>
</body>
</html>
diff --git a/static/redirect.js b/static/redirect.js
index 80091cb9..d5542593 100644
--- a/static/redirect.js
+++ b/static/redirect.js
@@ -10,9 +10,16 @@
// https://www.w3.org/People/Bos/redirect
// https://www.w3.org/Protocols/HTTP/Fragment/draft-bos-http-redirect-00.txt
+const redirects = new Map([
+ ["/#device-support", "/faq#device-support"],
+]);
+
function handle_hash() {
- if (window.location.hash === "#device-support") {
- window.location.replace("https://grapheneos.org/faq#device-support");
+ if (window.location.hash) {
+ const redirect = redirects.get(window.location.pathname + window.location.hash);
+ if (redirect) {
+ window.location.replace(redirect);
+ }
}
}