Unverified Commit 446083e2 authored by Delba de Oliveira's avatar Delba de Oliveira Committed by GitHub

Docs: Document `crossOrigin` option (#61455)

parent c1aa8ddf
---
title: crossOrigin
description: Use the `crossOrigin` option to add a crossOrigin tag on the `script` tags generated by `next/script`.
---
{/* The content of this doc is shared between the app and pages router. You can use the `<PagesOnly>Content</PagesOnly>` component to add content that is specific to the Pages Router. Any shared content should not be wrapped in a component. */}
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 <AppOnly>[`next/script`](/docs/app/building-your-application/optimizing/scripts) component</AppOnly> <PagesOnly>[`next/script`](/docs/pages/building-your-application/optimizing/scripts) and [`next/head`](/docs/pages/api-reference/components/head)components</PagesOnly>, 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).
---
title: crossOrigin
description: Use the `crossOrigin` option to add a crossOrigin tag on the `script` tags generated by `next/script` and `next/head`.
source: app/api-reference/next-config-js/crossOrigin
---
{/* The content of this doc is shared between the app and pages router. You can use the `<PagesOnly>Content</PagesOnly>` component to add content that is specific to the Pages Router. Any shared content should not be wrapped in a component. */}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment