diff --git a/src/pages/options/routes/script/ScriptEditor.tsx b/src/pages/options/routes/script/ScriptEditor.tsx index 291484dd2..435527335 100644 --- a/src/pages/options/routes/script/ScriptEditor.tsx +++ b/src/pages/options/routes/script/ScriptEditor.tsx @@ -148,9 +148,9 @@ const emptyScript = async (template: string, hotKeys: any, target?: string) => { const pageUrl = result?.activeTabUrl?.url; if (pageUrl) { try { - const { protocol, pathname, hostname } = new URL(pageUrl); + const { protocol, pathname, hostname, search } = new URL(pageUrl); if (protocol && pathname && hostname) { - retUrl = `${protocol}//${hostname}${pathname}`; + retUrl = `${protocol}//${hostname}${pathname}${search.length > 1 ? search : ""}`; if (protocol === "http:" || protocol === "https:") { retIcon = `https://www.google.com/s2/favicons?sz=64&domain=${hostname}`; }