直接链接(英语:Inline linking),也称热链接(hotlinking)、leeching、piggy-backing、直接链接(direct linking)、异站图像抓取(offsite image grabs)等,它是指在一个网站的网页上,未经允许地使用使用链接对象直接调用另一个网站上的资源(通常是图像)。在如今的互联网上,未经授权的直接链接常被简称为盗链。
在万维网幕后的超文本传输协议(HTTP)技术中,并未对链路类型做任何区分,所有链接的功能均为平等,资源可以位于任何服务器的任何位置。
当访问一个网站时,浏览器首先下载HTML格式的文档内容。下载的HTML文档可能调用其他HTML文件、图像、脚本及样式表等文件。这些文件可以包含<img>
标签以在页面上显示所提供URL位置的图像。其中的HTML代码可能不指定服务器,从而使网页浏览器使用与父代码(<img src="picture.jpg" />
)相同的服务器。但它也可以指定在某个服务器上托管的图像的绝对URL,例如(<img src="http://www.example.com/picture.jpg" />
。
在浏览器下载到包含图像的HTML图像后,浏览器将联系远程服务器以请求图像内容。
在一个网站中可以显示另一个网站的内容是万维网超文本媒体原始设计中的一部分。常见的用法包括:
当网站违背用户期望时,网站之间模糊的边际会导致其他问题。有些时候,直接链接也可用于恶意目的。
大多数网页浏览器都将直接根据网页指示来获取图像。 嵌入式图像可能以此作为一个网络信标来跟踪用户或将信息传递给第三方。有许多广告过滤(英语:Ad filtering)工具可不同程度地限制此类行为。
部分服务器采用HTTP引用地址等技术检测直接链接,并可根据相同格式返回错误、告知、引导或谴责信息,代替原始的目标图像。大多数服务器都可配置为避免为第三方直接链接提供托管的媒体内容。
URL重写(例如Apache HTTP Server的mod_rewrite)经常被用于拒绝或重定向直接链接的图像或媒体内容到其他资源。大多数媒体资源都可通过此种方式重定向,包括视频文件、音频文件、动画资源(例如Flash)等。
Other solutions usually combine URL重写 with some custom complex server side scripting to allow hotlinking for a short time, or in more complex setups to allow the hotlinking but return an alternative image with reduced quality and size and thus reduce the bandwidth load when requested from a remote server. All hotlink prevention measures risk deteriorating the user experience on third party website.
The most significant legal fact about inline linking, relative to copyright law considerations, is that the inline linker does not place a copy of the image file on its own Internet server. Rather, the inline linker places a pointer on its Internet server that points to the server on which the proprietor of the image has placed the image file. This pointer causes a user's browser to jump to the proprietor's server and fetch the image file to the user's computer. US courts have considered this a decisive fact in copyright analysis. Thus, in , the 美国联邦第九巡回上诉法院 explained why inline linking did not violate US copyright law:
Google does not...display a copy of full-size infringing photographic images for purposes of the Copyright Act when Google frames in-line linked images that appear on a user’s computer screen. Because Google’s computers do not store the photographic images, Google does not have a copy of the images for purposes of the Copyright Act. In other words, Google does not have any “material objects...in which a work is fixed...and from which the work can be perceived, reproduced, or otherwise communicated” and thus cannot communicate a copy. Instead of communicating a copy of the image, Google provides HTML instructions that direct a user’s browser to a website publisher’s computer that stores the full-size photographic image. Providing these HTML instructions is not equivalent to showing a copy. First, the HTML instructions are lines of text, not a photographic image. Second, HTML instructions do not themselves cause infringing images to appear on the user’s computer screen. The HTML merely gives the address of the image to the user’s browser. The browser then interacts with the computer that stores the infringing image. It is this interaction that causes an infringing image to appear on the user’s computer screen. Google may facilitate the user’s access to infringing images. However, such assistance raised only contributory liability issues and does not constitute direct infringement of the copyright owner’s display rights. ...While in-line linking and framing may cause some computer users to believe they are viewing a single Google webpage, the Copyright Act...does not protect a copyright holder against acts....