mirror of
https://github.com/fmhy/FMHY-SafeGuard.git
synced 2026-03-11 08:55:40 +00:00
Update background.js
Updated RegEx
This commit is contained in:
parent
782ea1ea38
commit
1f88becc79
1 changed files with 5 additions and 2 deletions
|
|
@ -28,9 +28,12 @@ function extractUrlsFromBookmarks(html) {
|
|||
return urls;
|
||||
}
|
||||
|
||||
// Helper function to normalize URLs (removes trailing slashes)
|
||||
// Helper function to normalize URLs (removes trailing slashes, query parameters, and fragments)
|
||||
function normalizeUrl(url) {
|
||||
return url.replace(/\/+$/, ""); // Remove trailing slash only, no www. removal
|
||||
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 root domain from URL
|
||||
|
|
|
|||
Loading…
Reference in a new issue