Untitled
unknown
plain_text
a month ago
493 B
4
Indexable
function redirectFn() { var currentPath = window.location.pathname; // Check if "-b" is already present in the pathname if (currentPath.indexOf("-b") !== -1) { // console.log("Already contains '-b', no redirect needed."); return; } // Remove trailing slash and append "-b" and the query string var modifiedPath = currentPath.replace(/\/$/, "") + "-b" + window.location.search; // Perform the redirection window.location.href = modifiedPath; }
Editor is loading...
Leave a Comment