Files
Delba de OliveiraGitHubJosephgraphite-app[bot] <96075541+graphite-app[bot]@users.noreply.github.com>
2e2ee08b60 Docs IA 2.0: Delete routing section, add BFF guide, polish getting started (#80365)
Closes:
https://linear.app/vercel/issue/DOC-4686/clean-up-routing-section
Redirects: https://github.com/vercel/front/pull/47151

---------

Co-authored-by: Joseph <[email protected]>
Co-authored-by: graphite-app[bot] <96075541+graphite-app[bot]@users.noreply.github.com>
2025-06-16 13:42:20 +01:00

20 lines
1.2 KiB
Plaintext

---
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/guides/scripts) component</AppOnly> <PagesOnly>[`next/script`](/docs/pages/guides/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).