(function() {
// 1. Get the referrer (the URL the user came from)
var referrer = document.referrer;
// 2. Check if the referrer contains the text "form" (case-insensitive)
if (referrer && referrer.toLowerCase().indexOf("-form") !== -1) {
// SUCCESS: If they came from a URL with "form" in it, show the page.
// Ensure your CSS initially hides the body (body { display: none; })
// for this to look smooth, otherwise the page flashes before checking.
document.body.style.display = "block";
} else {
// FAILURE: If they did NOT come from a "form" URL.
// Check if there is history to go back to
if (window.history.length > 1) {
// Go back to the previous page
window.history.back();
} else {
// Fallback: If there is no history (e.g., they opened the link in a new tab directly),
// you usually want to send them to a specific safe page, like your homepage.
// You can leave this blank if you strictly only want history.back(),
// but it's safer to have a fallback.
window.location.href = "https://bluewhale.bio";
}
}
})();