diff --git a/src/client/dom/history.ts b/src/client/dom/history.ts index df48d3a..6abd704 100644 --- a/src/client/dom/history.ts +++ b/src/client/dom/history.ts @@ -5,7 +5,8 @@ import { UrlChangeEvent } from "../events"; export default function (client: ScramjetClient, self: typeof globalThis) { client.Proxy("History.prototype.pushState", { apply(ctx) { - if (ctx.args[2]) ctx.args[2] = rewriteUrl(ctx.args[2], client.meta); + if (ctx.args[2] || ctx.args[2] === "") + ctx.args[2] = rewriteUrl(ctx.args[2], client.meta); ctx.call(); const ev = new UrlChangeEvent(client.url.href); @@ -15,7 +16,8 @@ export default function (client: ScramjetClient, self: typeof globalThis) { client.Proxy("History.prototype.replaceState", { apply(ctx) { - if (ctx.args[2]) ctx.args[2] = rewriteUrl(ctx.args[2], client.meta); + if (ctx.args[2] || ctx.args[2] === "") + ctx.args[2] = rewriteUrl(ctx.args[2], client.meta); ctx.call(); const ev = new UrlChangeEvent(client.url.href);