generic anchor redirect code
This commit is contained in:
parent
09488a2018
commit
e81f367be6
@ -114,6 +114,6 @@
|
|||||||
<li><a href="https://reddit.com/r/GrapheneOS">Reddit</a></li>
|
<li><a href="https://reddit.com/r/GrapheneOS">Reddit</a></li>
|
||||||
</ul>
|
</ul>
|
||||||
</footer>
|
</footer>
|
||||||
<script src="/redirect.js?0"></script>
|
<script src="/redirect.js?1"></script>
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
|
@ -10,9 +10,16 @@
|
|||||||
// https://www.w3.org/People/Bos/redirect
|
// https://www.w3.org/People/Bos/redirect
|
||||||
// https://www.w3.org/Protocols/HTTP/Fragment/draft-bos-http-redirect-00.txt
|
// 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() {
|
function handle_hash() {
|
||||||
if (window.location.hash === "#device-support") {
|
if (window.location.hash) {
|
||||||
window.location.replace("https://grapheneos.org/faq#device-support");
|
const redirect = redirects.get(window.location.pathname + window.location.hash);
|
||||||
|
if (redirect) {
|
||||||
|
window.location.replace(redirect);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user