Extend NavigationInterceptOptions - optional url field
uasan opened this issue · 3 comments
There are many cases (trailing slashes, the most common case) where it is necessary to change the url in the navigation event handler method without canceling the current event and not create new event.
For example, we have canonical urls, if the user go to a non-canonical alias, we need to make the transition, but change this url to canonical, without canceling the current event, so that the caller does not receive a cancellation exception.
I propose extends NavigationInterceptOptions
add optional property url
- correct string value within the current location.origin.
navigation.addEventListener('navigate', e => {
//...
e.intercept({
url: isNonCanonical(e.destination.url) ? getCanonical(e.destination.url) : undefined,
async handler() {
// ....
}
});
});
What do you think?
Is this the same request as a client side redirect? #124
Thanks, I didn’t read it.
Yes, these are solutions to the same problems.
I briefly suggested a simple solution here using a real example