diff options
Diffstat (limited to 'frontend')
-rw-r--r-- | frontend/query.ts | 2 | ||||
-rw-r--r-- | frontend/search.ts | 6 |
2 files changed, 6 insertions, 2 deletions
diff --git a/frontend/query.ts b/frontend/query.ts index 37f62f4..e8d41b1 100644 --- a/frontend/query.ts +++ b/frontend/query.ts @@ -34,7 +34,7 @@ export async function process_query(default_engine: string, query: string) { if (!url) return status("error", "Invalid search engine.") status("success", `Forwarding to ${url}`) - setTimeout(() => document.location.href = url!, 0) + document.location.replace(url) } async function search_url(engine: string, query: string) { diff --git a/frontend/search.ts b/frontend/search.ts index bca2fc0..40b7f91 100644 --- a/frontend/search.ts +++ b/frontend/search.ts @@ -24,11 +24,15 @@ export function section_search(engine: string) { const input = e("input", { type: "text" }) input.addEventListener("keydown", ev => { - if (ev.code == "Enter") process_query(engine, input.value ?? "") + if (ev.code == "Enter") { + history.pushState({}, "", window.location.href) + process_query(engine, input.value ?? "") + } }) const submit = e("button", {}, "Search") submit.addEventListener("click", () => { + history.pushState({}, "", window.location.href) process_query(engine, input.value ?? "") }) |