Add quick exit functionality to prevent navigation back to the site after a user exits. Implemented in multiple HTML files and updated script.js for session management.

This commit is contained in:
blake committed 2026-09-29 15:20:57 -05:00
1 parent a772e454e6
commit 9d9b6ed918
12 files changed
+188

No files matched your search

+12
View File
@@ -2,6 +2,18 @@
<html lang="en" class="no-js">
<head>
<meta charset="UTF-8" />
<script>
(function () {
try {
var navigation = performance.getEntriesByType("navigation")[0];
var type = navigation && navigation.type;
if (type === "back_forward" && sessionStorage.getItem("quick-exit") === "1") {
document.documentElement.hidden = true;
location.replace("https://www.google.com/");
}
} catch (error) {}
})();
</script>
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<meta name="referrer" content="no-referrer" />
<meta name="robots" content="noindex" />
+12
View File
@@ -2,6 +2,18 @@
<html lang="en" class="no-js">
<head>
<meta charset="UTF-8" />
<script>
(function () {
try {
var navigation = performance.getEntriesByType("navigation")[0];
var type = navigation && navigation.type;
if (type === "back_forward" && sessionStorage.getItem("quick-exit") === "1") {
document.documentElement.hidden = true;
location.replace("https://www.google.com/");
}
} catch (error) {}
})();
</script>
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<meta name="referrer" content="no-referrer" />
<meta name="description" content="Read the accessibility commitment for the Whispers of Love, Hope, and Joy website and learn how to request assistance." />
+12
View File
@@ -2,6 +2,18 @@
<html lang="en" class="no-js">
<head>
<meta charset="UTF-8" />
<script>
(function () {
try {
var navigation = performance.getEntriesByType("navigation")[0];
var type = navigation && navigation.type;
if (type === "back_forward" && sessionStorage.getItem("quick-exit") === "1") {
document.documentElement.hidden = true;
location.replace("https://www.google.com/");
}
} catch (error) {}
})();
</script>
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<meta name="referrer" content="no-referrer" />
<meta name="description" content="Find support from Whispers of Love, Hope, and Joy in Northwest Iowa." />
+12
View File
@@ -2,6 +2,18 @@
<html lang="en" class="no-js">
<head>
<meta charset="UTF-8" />
<script>
(function () {
try {
var navigation = performance.getEntriesByType("navigation")[0];
var type = navigation && navigation.type;
if (type === "back_forward" && sessionStorage.getItem("quick-exit") === "1") {
document.documentElement.hidden = true;
location.replace("https://www.google.com/");
}
} catch (error) {}
})();
</script>
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<meta name="referrer" content="no-referrer" />
<meta name="description" content="Give, volunteer, or build a community partnership with Whispers of Love, Hope, and Joy in Northwest Iowa." />
+12
View File
@@ -2,6 +2,18 @@
<html lang="en" class="no-js">
<head>
<meta charset="UTF-8" />
<script>
(function () {
try {
var navigation = performance.getEntriesByType("navigation")[0];
var type = navigation && navigation.type;
if (type === "back_forward" && sessionStorage.getItem("quick-exit") === "1") {
document.documentElement.hidden = true;
location.replace("https://www.google.com/");
}
} catch (error) {}
})();
</script>
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<meta name="referrer" content="no-referrer" />
<meta name="description" content="Whispers of Love, Hope, and Joy provides Christ-centered support, practical help, and healing community for survivors of domestic abuse in Northwest Iowa." />
+12
View File
@@ -2,6 +2,18 @@
<html lang="en" class="no-js">
<head>
<meta charset="UTF-8" />
<script>
(function () {
try {
var navigation = performance.getEntriesByType("navigation")[0];
var type = navigation && navigation.type;
if (type === "back_forward" && sessionStorage.getItem("quick-exit") === "1") {
document.documentElement.hidden = true;
location.replace("https://www.google.com/");
}
} catch (error) {}
})();
</script>
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<meta name="referrer" content="no-referrer" />
<meta name="description" content="Learn how the Whispers of Love, Hope, and Joy website handles privacy, outside services, and safety-sensitive communications." />
+56
View File
@@ -3,13 +3,46 @@
document.documentElement.classList.replace("no-js", "js");
const QUICK_EXIT_URL = "https://www.google.com/";
const QUICK_EXIT_KEY = "quick-exit";
const STAGING_HOST = "whispersoflhj.cosmicallycreative.com";
const MOBILE_NAV_QUERY = window.matchMedia("(max-width: 88em)");
function navigationType() {
const navigation = performance.getEntriesByType("navigation")[0];
return navigation ? navigation.type : "";
}
function quickExit() {
try {
// Remember the exit for this tab so Back cannot reopen the site.
sessionStorage.setItem(QUICK_EXIT_KEY, "1");
} catch (error) {}
document.documentElement.hidden = true;
if (document.body) document.body.replaceChildren();
window.location.replace(QUICK_EXIT_URL);
}
try {
if (navigationType() === "back_forward" && sessionStorage.getItem(QUICK_EXIT_KEY) === "1") {
document.documentElement.hidden = true;
window.location.replace(QUICK_EXIT_URL);
}
} catch (error) {}
window.addEventListener("pageshow", (event) => {
if (!event.persisted) return;
try {
if (sessionStorage.getItem(QUICK_EXIT_KEY) !== "1") return;
} catch (error) {
return;
}
document.documentElement.hidden = true;
window.location.replace(QUICK_EXIT_URL);
});
document.querySelectorAll(".quick-exit").forEach((link) => {
link.addEventListener("click", (event) => {
event.preventDefault();
@@ -31,6 +64,29 @@ document.addEventListener("keydown", (event) => {
quickExit();
});
document.addEventListener("click", (event) => {
if (event.defaultPrevented || event.button !== 0) return;
if (event.metaKey || event.ctrlKey || event.shiftKey || event.altKey) return;
const link = event.target.closest("a[href]");
if (!link || link.classList.contains("quick-exit")) return;
if (link.target && link.target !== "_self") return;
if (link.hasAttribute("download")) return;
let url;
try {
url = new URL(link.href);
} catch (error) {
return;
}
if (url.origin !== window.location.origin) return;
if (url.pathname === window.location.pathname && url.search === window.location.search && url.hash) return;
event.preventDefault();
window.location.replace(url.href);
});
document.querySelectorAll(".nav").forEach((nav) => {
const toggle = nav.querySelector(".mobile-nav-toggle");
const toggleLabel = toggle?.querySelector(".mobile-nav-toggle-label");
+12
View File
@@ -2,6 +2,18 @@
<html lang="en" class="no-js">
<head>
<meta charset="UTF-8" />
<script>
(function () {
try {
var navigation = performance.getEntriesByType("navigation")[0];
var type = navigation && navigation.type;
if (type === "back_forward" && sessionStorage.getItem("quick-exit") === "1") {
document.documentElement.hidden = true;
location.replace("https://www.google.com/");
}
} catch (error) {}
})();
</script>
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<meta name="referrer" content="no-referrer" />
<meta name="description" content="Learn about Shop Church, a relaxed and welcoming worshiping community connected to Whispers of Love, Hope, and Joy in Sioux Center, Iowa." />
+12
View File
@@ -2,6 +2,18 @@
<html lang="en" class="no-js">
<head>
<meta charset="UTF-8" />
<script>
(function () {
try {
var navigation = performance.getEntriesByType("navigation")[0];
var type = navigation && navigation.type;
if (type === "back_forward" && sessionStorage.getItem("quick-exit") === "1") {
document.documentElement.hidden = true;
location.replace("https://www.google.com/");
}
} catch (error) {}
})();
</script>
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<meta name="referrer" content="no-referrer" />
<meta name="description" content="Practical safety-planning, technology-safety, and support resources for people experiencing domestic abuse in Northwest Iowa." />
+12
View File
@@ -2,6 +2,18 @@
<html lang="en" class="no-js">
<head>
<meta charset="UTF-8" />
<script>
(function () {
try {
var navigation = performance.getEntriesByType("navigation")[0];
var type = navigation && navigation.type;
if (type === "back_forward" && sessionStorage.getItem("quick-exit") === "1") {
document.documentElement.hidden = true;
location.replace("https://www.google.com/");
}
} catch (error) {}
})();
</script>
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<meta name="referrer" content="no-referrer" />
<meta name="description" content="Learn about the Talitha Koum Healing Campus, a restorative community offering safe housing and whole-person support for women and children." />
+12
View File
@@ -2,6 +2,18 @@
<html lang="en" class="no-js">
<head>
<meta charset="UTF-8" />
<script>
(function () {
try {
var navigation = performance.getEntriesByType("navigation")[0];
var type = navigation && navigation.type;
if (type === "back_forward" && sessionStorage.getItem("quick-exit") === "1") {
document.documentElement.hidden = true;
location.replace("https://www.google.com/");
}
} catch (error) {}
})();
</script>
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<meta name="referrer" content="no-referrer" />
<meta name="description" content="Learn how Whispers of Love, Hope, and Joy walks alongside women and families through safety, healing, practical support, and lasting relationships." />
+12
View File
@@ -2,6 +2,18 @@
<html lang="en" class="no-js">
<head>
<meta charset="UTF-8" />
<script>
(function () {
try {
var navigation = performance.getEntriesByType("navigation")[0];
var type = navigation && navigation.type;
if (type === "back_forward" && sessionStorage.getItem("quick-exit") === "1") {
document.documentElement.hidden = true;
location.replace("https://www.google.com/");
}
} catch (error) {}
})();
</script>
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<meta name="referrer" content="no-referrer" />
<meta name="description" content="Learn how Whispers of Love, Hope, and Joy began, what guides its work, and how its community continues to grow across Northwest Iowa." />