---
title: crossOrigin
description: "Use the `crossOrigin` option to add a crossOrigin tag on the `script` tags generated by `next/script` and `next/head`."
url: "https://nextjs.org/docs/15/pages/api-reference/config/next-config-js/crossOrigin"
version: 15.5.15
lastUpdated: 2025-04-15
prerequisites:
  - "Configuration: /docs/15/pages/api-reference/config"
  - "next.config.js Options: /docs/15/pages/api-reference/config/next-config-js"
---


Use the `crossOrigin` option to add a [`crossOrigin` attribute](https://developer.mozilla.org/en-US/docs/Web/HTML/Attributes/crossorigin) in all `<script>` tags generated by the  , and define how cross-origin requests should be handled.

```js filename="next.config.js"
module.exports = {
  crossOrigin: 'anonymous',
}
```

## Options

* `'anonymous'`: Adds [`crossOrigin="anonymous"`](https://developer.mozilla.org/en-US/docs/Web/HTML/Attributes/crossorigin#anonymous) attribute.
* `'use-credentials'`: Adds [`crossOrigin="use-credentials"`](https://developer.mozilla.org/en-US/docs/Web/HTML/Attributes/crossorigin#use-credentials).
---

For an index of all available documentation, see [/docs/15/llms.txt](/docs/15/llms.txt)