Skip to content

replaceState Error when path starts with // and scrollBehavior is set #2593

@yegorLitvinov

Description

Version

3.0.2

Reproduction link

https://github.com/yegorLitvinov/vue-router-bug

Steps to reproduce

Set scrollBehavior property in router config. Put two forward slashes into beginning of the url (e.g. http://localhost:8081//about)

What is expected?

No errors in console

What is actually happening?

In firefox: SecurityError: The operation is insecure.
In Chrome: Uncaught DOMException: Failed to execute 'replaceState' on 'History': A history state object with URL 'http://about/' cannot be created in a document with origin 'http://localhost:8081' and URL 'http://localhost:8081//about'

Metadata

Assignees

No one assigned

    Labels

    bugfixed on 4.xThis issue has been already fixed on the v4 but exists in v3

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions