decred / politeiagui

ISC License
62 stars 56 forks source link

[plugin-architecture] External URL error on router navigation #2767

Closed victorgcramos closed 2 years ago

victorgcramos commented 2 years ago

window.history.pushState does not allow external domain urls, and it breaks the app logging the following error when you pass an external domain to router.navigateTo method.

router.js:82 Uncaught DOMException: Failed to execute 'pushState' on 'History': A history state object with URL 'https://google.com/' cannot be created in a document with origin 'https://localhost:3000' and URL 'https://localhost:3000/'

Example:

<button onClick={() => router.navigateTo("https://google.com")}>
  Navigate!
</button>
tiagoalvesdulce commented 2 years ago

I agree it should not break the app. But to navigate to external URLs window methods should be used instead.