---
title: "JavaScript:referrer property"
author: "ilusm"
date: "2008-08-25T10:32:53Z"
tags: []
slug: "javascript-referrer-property"
draft: false
lastmod: "2008-08-25T10:32:53Z"
id: 232267
url: "https://ilusm.iteye.com/blog/232267"
---

## referrer property

Specifies the URL of the calling document when a user clicks a link.

### 语法 `document.referrer`

### Property of

document

### 描述

When a user navigates to a *destination* document by clicking a link object on a *source* document, the referrer property contains the URL of the *source* document. Evaluate the referrer property from the *destination* document.

referrer is a read-only property.

### 例子

In the following example, the *getReferrer()* function is called from the *destination* document. It returns the URL of the *source* document.

```
function getReferrer() {
   return document.referrer
}

```