【问题标题】:SvelteKit: Disable internal link routing for certain <a> links served from the same hostSvelteKit:禁用从同一主机提供的某些 <a> 链接的内部链接路由
【发布时间】:2021-09-12 15:46:33
【问题描述】:

我在 Svelte 组件中有一个链接。此链接的目标由保留代理服务器处理,因此链接目标不是 Svelte 应用程序的一部分,即使它与 Svelte 应用程序共享相同的 URL 路径。

如果我单击链接,Svelte 会尝试使用其内部路由器解析链接。如何强制 Svelte 中的链接由 Web 浏览器加载并被内部路由器跳过?

我的链接代码是:

<!-- /docs/ is served from the reverse proxy by the web server and not part of Svelte -->
<a href="https://tradingstrategy.ai/docs/index.html">Documentation</a>

【问题讨论】:

    标签: svelte sveltekit


    【解决方案1】:

    您可以告诉 SvelteKit 跳过处理链接并使用带有 rel="external" 属性的普通浏览器导航。

    此属性记录在此:https://kit.svelte.dev/docs#anchor-options-rel-external

    <a rel="external" href="https://tradingstrategy.ai/docs/index.html">Documentation</a>
    

    【讨论】:

      猜你喜欢
      • 2018-03-16
      • 1970-01-01
      • 1970-01-01
      • 2023-04-01
      • 1970-01-01
      • 2019-05-11
      • 1970-01-01
      • 2020-06-11
      • 1970-01-01
      相关资源
      最近更新 更多