diff options
| author | Daniel Micay <danielmicay@gmail.com> | 2020-02-14 16:22:45 -0500 |
|---|---|---|
| committer | Daniel Micay <danielmicay@gmail.com> | 2020-02-14 16:22:45 -0500 |
| commit | e81f367be64132eb5c2d753313244cc1858d0c54 (patch) | |
| tree | b9f1bb9855448d0392ff85684c04ea50f42ea0bf /static/redirect.js | |
| parent | 09488a20181ef87ae7b3df2f2f577198c0f4e73a (diff) | |
generic anchor redirect code
Diffstat (limited to 'static/redirect.js')
| -rw-r--r-- | static/redirect.js | 11 |
1 files changed, 9 insertions, 2 deletions
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); + } } } |
