Skip to content

Make React router raise an error when History.replaceState() URL is not of the same origin as the current URL #20872

Open
@mcollovati

Description

Currently, in Vaadin applications with React router enabled, when invoking Page.getHistory().replaceState() passing an absolute URL that is not of the same origin as the current URL, the browser URL is updated by appending the given URL to the document URL.

For example, Page.getHistory().replaceState(null, "http://www.google.com") will result in the browser URL to be http://localhost:8080/http://www.google.com.

However, with Vaadin router, the same call results in an error in the browser console

Image

Based on the Javascript History.replaceState() documentation, this seems to be the expected behavior.

url Optional
The URL of the history entry. The new URL must be of the same origin as the current URL; otherwise the replaceState() method throws an exception.

It would make sense that the Vaadin application behaves the same way, regardless of the router used.

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions