Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

NEW FEATURE: Forcing server fetch #424

Closed
sahilshah50 opened this issue Jan 7, 2020 · 1 comment
Closed

NEW FEATURE: Forcing server fetch #424

sahilshah50 opened this issue Jan 7, 2020 · 1 comment

Comments

@sahilshah50
Copy link

If one wants to force certain link href urls to be compulsorily fetched from server, rather than being handled at client side by router, there is no way to do so. Unless you modify and provide your own custom click handler with additional logic.

However, supporting this feature requires a really simple change in the triggers\click.js file.

// ignore the click if the <a> element has the 'download' or 'router-ignore' attribute
if (anchor.hasAttribute('download') || anchor.hasAttribute('vaadin-ignore')) {
    return;
}

The click.js logic already checks and ignores handling click when the link has "download" attribute. The same can be applied for a custom attribute say "vaadin-ignore". If the link has that attribute than avoid handling the click and let browser continue with server fetch.

I recall some routing frameworks monitor target="_self" for this purpose. However, in your code you have specifically decided to ignore targets other than "_self". Hence, suggesting the custom attribute option. Otherwise, as an alternative, you can also consider full server fetch for target="_self".

@vlukashov
Copy link

Good news! This feature has been just recently added to Vaadin Router. It's available since the 1.6.0 release.

However, I've noticed that the docs have not been updated on time, and thus it was not properly documented. Now that is also fixed and the docs have been updated. You can find it by searching for excluded links on the Getting Started page.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants