diff --git a/.changeset/loud-pans-fly.md b/.changeset/loud-pans-fly.md new file mode 100644 index 000000000000..1e595deb3353 --- /dev/null +++ b/.changeset/loud-pans-fly.md @@ -0,0 +1,5 @@ +--- +'@sveltejs/kit': patch +--- + +docs: discourage use of `goto` with external URLs diff --git a/packages/kit/types/ambient.d.ts b/packages/kit/types/ambient.d.ts index 79801c8a3928..606475b4c380 100644 --- a/packages/kit/types/ambient.d.ts +++ b/packages/kit/types/ambient.d.ts @@ -170,6 +170,7 @@ declare module '$app/navigation' { export function disableScrollHandling(): void; /** * Returns a Promise that resolves when SvelteKit navigates (or fails to navigate, in which case the promise rejects) to the specified `url`. + * For external URLs, use `window.location = url` instead of calling `goto(url)`. * * @param url Where to navigate to. Note that if you've set [`config.kit.paths.base`](https://kit.svelte.dev/docs/configuration#paths) and the URL is root-relative, you need to prepend the base path if you want to navigate within the app. * @param opts Options related to the navigation