history_api
history_api copied to clipboard
onbeforenavigate redirect support
"redirect" is a common pattern. Ex: all external navigations go through "t.co"
How do you find the url user is navigating to inside onbeforenavigate handler?
Proposed API:
history.onbeforenavigate = (e) => {
e.redirect(`newUrl?from={e.url}`)
}
POST requests cannot be redirected.
Does such a redirect require a network fetch or is it just a URL change? Is this not currently achievable with the existing API? Or are you just asking for a more specific API?
It is just a URL change.
It might be achievable through the existing API, but I do not see it. How would you do it?
I think this has been solved by https://github.com/slightlyoff/history_api/blob/master/app_history.md#example-single-page-app-redirects