From 5ee7dfce50597fea6afc7c6f35846f45f533f729 Mon Sep 17 00:00:00 2001 From: Dinkar Date: Sun, 13 Oct 2024 18:13:06 +0530 Subject: [PATCH] some handlings --- 404.html | 56 ++++++++++++++++++++++++++++++-------------------------- 1 file changed, 30 insertions(+), 26 deletions(-) diff --git a/404.html b/404.html index b8cd5fc..f80025d 100644 --- a/404.html +++ b/404.html @@ -9,33 +9,37 @@ var maxRedirects = 2; var redirectCount = parseInt(sessionStorage.getItem('redirects')) || 0; + console.log(redirectCount); if (redirectCount >= maxRedirects) { - sessionStorage.removeItem('redirects'); - document.body.innerHTML = "

404 Not Found

The page you are looking for doesn't exist.

"; - return; - } - sessionStorage.setItem('redirects', ++redirectCount); - var l = window.location; - l.replace( - l.protocol + - "//" + - l.hostname + - (l.port ? ":" + l.port : "") + - l.pathname - .split("/") - .slice(0, 1 + pathSegmentsToKeep) - .join("/") + - "/?/" + - l.pathname - .slice(1) - .split("/") - .slice(pathSegmentsToKeep) - .join("/") - .replace(/&/g, "~and~") + - (l.search ? "&" + l.search.slice(1).replace(/&/g, "~and~") : "") + - l.hash - ); + console.log(redirectCount, 'inside'); + // sessionStorage.removeItem('redirects'); + } else { + sessionStorage.setItem('redirects', ++redirectCount); + var l = window.location; + l.replace( + l.protocol + + "//" + + l.hostname + + (l.port ? ":" + l.port : "") + + l.pathname + .split("/") + .slice(0, 1 + pathSegmentsToKeep) + .join("/") + + "/?/" + + l.pathname + .slice(1) + .split("/") + .slice(pathSegmentsToKeep) + .join("/") + .replace(/&/g, "~and~") + + (l.search ? "&" + l.search.slice(1).replace(/&/g, "~and~") : "") + + l.hash + ); + } - + +

404 Not Found

+

The page you are looking for doesn't exist.

+