mirror of
https://github.com/fmhy/FMHY-SafeGuard.git
synced 2026-03-11 08:55:40 +00:00
Update index.js
This commit is contained in:
parent
1f88becc79
commit
6a055a92a1
1 changed files with 7 additions and 2 deletions
|
|
@ -5,8 +5,13 @@ document.addEventListener("DOMContentLoaded", () => {
|
|||
const statusMessage = document.getElementById("status-message");
|
||||
const errorMessage = document.getElementById("error-message");
|
||||
|
||||
// Helper function to normalize URLs (removes trailing slashes)
|
||||
const normalizeUrl = (url) => url.replace(/\/+$/, "").trim();
|
||||
// Helper function to normalize URLs (removes trailing slashes, query parameters, and fragments)
|
||||
const normalizeUrl = (url) => {
|
||||
const urlObj = new URL(url);
|
||||
urlObj.search = ""; // Remove query parameters
|
||||
urlObj.hash = ""; // Remove fragments
|
||||
return urlObj.href.replace(/\/+$/, ""); // Remove trailing slash only
|
||||
};
|
||||
|
||||
// Helper function to extract the root domain from a URL
|
||||
function extractRootDomain(url) {
|
||||
|
|
|
|||
Loading…
Reference in a new issue