# HasReferrerpolicy

> Provides an immutable API for the referrerpolicy attribute.

[API reference](/docs/api/index.md) › [HTML Attribute](/docs/extensions/html-attribute/reference/index.md) › HasReferrerpolicy

| trait | `UIAwesome\Html\Attribute\HasReferrerpolicy` |
| --- | --- |
| Source | [`src/HasReferrerpolicy.php`](https://github.com/ui-awesome/html-attribute/blob/main/src/HasReferrerpolicy.php#L20) |

Used by 3 types:

- [`UIAwesome\Html\Metadata\Link`](/docs/extensions/html/reference/metadata/link/index.md)
- [`UIAwesome\Html\Metadata\Script`](/docs/extensions/html/reference/metadata/script/index.md)
- [`UIAwesome\Html\Palpable\A`](/docs/extensions/html/reference/palpable/a/index.md)

Provides an immutable API for the `referrerpolicy` attribute.

See also: <https://developer.mozilla.org/en-US/docs/Web/HTML/Attributes/referrerpolicy>.

## Methods

| Method | Description | Defined by |
| --- | --- | --- |
| [`referrerpolicy()`](#method-referrerpolicy) | Sets the `referrerpolicy` attribute. | `HasReferrerpolicy` |

## Method details

### referrerpolicy() <span id="method-referrerpolicy"></span>

```php
public function referrerpolicy(string|Stringable|UnitEnum|null $value): static
```

Sets the `referrerpolicy` attribute.

Controls how much referrer information is sent with requests.

**Parameters**

| Parameter | Type | Description |
| --- | --- | --- |
| `$value` | `string\|`[`Stringable`](https://www.php.net/manual/en/class.stringable.php)`\|`[`UnitEnum`](https://www.php.net/manual/en/class.unitenum.php)`\|null` | Referrer policy token, or `null` to remove the attribute. |

**Returns**

`static`: New instance with the updated `referrerpolicy` attribute. [`Referrerpolicy`](/docs/extensions/html-attribute/reference/values/referrerpolicy/index.md) for predefined enum values.

**Throws**

- [`InvalidArgumentException`](https://www.php.net/manual/en/class.invalidargumentexception.php): If the value is not valid.