inertia: Link component missing behavior for URLs from another origin
Version:
@inertiajs/vue3
version: 1.0.14
Describe the problem:
When I click on a link with a different host, a white screen is displayed and error 409 (Conflict) is written in the console. The Link component should redirect to the specified page if it receives a 409 conflict error.
Solution:
use location.href = linkComponentHref
whenever it gets 409 error.
This must be implemented inside Link component because all developers expect this component behave like this.
Steps to reproduce:
App.vue:
<script setup>
import {Link} from '@inertiajs/vue3';
</script>
<template>
<p>Hi this is my website at example.com</p>
<p>click on following link to see a random page from my website or another website which i don't own</p>
<Link href="https://google.com">Click here to see Google website</Link>
</template>
About this issue
- Original URL
- State: open
- Created 8 months ago
- Comments: 15 (7 by maintainers)
If the purpose of
Link
component is doing Inertia visit, It must be namedVisit
component notLink
component.Yeah. I agree with @RobertBoes on this one. It would add unnecessary lag to (what should be) links.
If this is required behaviour, it’s likely preferable to implement a userland solution such as a wrapper component where you can more accurately discern between internal and external links.
A universal solution would introduce unnecessary complexity and likely many edge cases.