summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Micay <danielmicay@gmail.com>2020-02-14 15:28:36 -0500
committerDaniel Micay <danielmicay@gmail.com>2020-02-14 15:34:45 -0500
commitc82909fb50515e7497a877540e7d95737bad8c2a (patch)
tree492c84280834fe0998e25dd0de56066dede9abad
parenta20ebf0779a4cbbdf12a48adf8c1c6c9061b0fca (diff)
client-side redirect for device-support section
-rw-r--r--static/index.html1
-rw-r--r--static/redirect.js22
2 files changed, 23 insertions, 0 deletions
diff --git a/static/index.html b/static/index.html
index d72a85fa..66af1a72 100644
--- a/static/index.html
+++ b/static/index.html
@@ -114,5 +114,6 @@
<li><a href="https://reddit.com/r/GrapheneOS">Reddit</a></li>
</ul>
</footer>
+ <script src="/redirect.js?0"></script>
</body>
</html>
diff --git a/static/redirect.js b/static/redirect.js
new file mode 100644
index 00000000..80091cb9
--- /dev/null
+++ b/static/redirect.js
@@ -0,0 +1,22 @@
+// @license magnet:?xt=urn:btih:d3d9a9a6595521f9666a5e94cc830dab83b65699&dn=expat.txt MIT
+
+"use strict";
+
+// Client-side redirects for fragments (anchors)
+//
+// It should be possible to do this with server-side redirects, but it was never implemented or
+// standardized. For reference:
+//
+// https://www.w3.org/People/Bos/redirect
+// https://www.w3.org/Protocols/HTTP/Fragment/draft-bos-http-redirect-00.txt
+
+function handle_hash() {
+ if (window.location.hash === "#device-support") {
+ window.location.replace("https://grapheneos.org/faq#device-support");
+ }
+}
+
+handle_hash();
+addEventListener("hashchange", handle_hash, false);
+
+// @license-end