mirror of
https://github.com/nuxt/nuxt.git
synced 2025-02-16 13:48:13 +00:00
fix(nuxt): provide default url for URL constructor
This commit is contained in:
parent
bff1ec237b
commit
8bdd620ba1
@ -140,7 +140,7 @@ export const navigateTo = (to: RouteLocationRaw | undefined | null, options?: Na
|
||||
if (!options?.external) {
|
||||
throw new Error('Navigating to an external URL is not allowed by default. Use `navigateTo(url, { external: true })`.')
|
||||
}
|
||||
const { protocol } = new URL(toPath)
|
||||
const { protocol } = new URL(toPath, import.meta.client ? window.location.href : 'http://localhost')
|
||||
if (protocol && isScriptProtocol(protocol)) {
|
||||
throw new Error(`Cannot navigate to a URL with '${protocol}' protocol.`)
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user