history_api icon indicating copy to clipboard operation
history_api copied to clipboard

onbeforenavigate redirect support

Open atotic opened this issue 4 years ago • 3 comments

"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.

atotic avatar Jun 24 '20 20:06 atotic

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?

tbondwilkinson avatar Jul 31 '20 14:07 tbondwilkinson

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?

atotic avatar Jul 31 '20 16:07 atotic

I think this has been solved by https://github.com/slightlyoff/history_api/blob/master/app_history.md#example-single-page-app-redirects

matt-buland-sfdc avatar Feb 03 '21 17:02 matt-buland-sfdc