<commit_before>---
title: origin
---

Visit multiple domains of different
[origin](https://developer.mozilla.org/en-US/docs/Web/Security/Same-origin_policy#definition_of_an_origin)
in a single test.

In normal use, a single Cypress test may only run commands in a single origin, a
limitation determined by standard web security features of the browser. The
`cy.origin()` command allows your tests to bypass this limitation.

<Alert type="warning">

<strong class="alert-header"><Icon name="exclamation-triangle"></Icon>
Experimental</strong>

The `cy.origin()` command is currently experimental and can be enabled by setting
the [`experimentalSessionAndOrigin`](/guides/references/experiments) flag
to `true` in the Cypress config.

Enabling this flag does the following:

- It adds the [`cy.session()`](/api/commands/session) and `cy.origin()`
  commands, and [`Cypress.session`](/api/cypress-api/session) API.
- It adds the following new behaviors (that will be the default in a future
  major update of Cypress) at the beginning of each test:
  - The page is cleared (by setting it to `about:blank`).
  - All active session data (cookies, `localStorage` and `sessionStorage`)
    across all domains are cleared.
- It overrides
  the [`Cypress.Cookies.preserveOnce()`](/api/cypress-api/cookies#Preserve-Once) and
  [`Cypress.Cookies.defaults()`](/api/cypress-api/cookies#Defaults) methods.
- Cross-domain requests will no longer fail immediately, but instead, time out
  based on [`pageLoadTimeout`](/guides/references/configuration#Timeouts).
- Tests will no longer wait on page loads before moving on to the next test.

Because the page is cleared before each
test, [`cy.visit()`](/api/commands/visit) must be explicitly called in each test
to visit a page in your application.

</Alert>

## Syntax

```js
cy.origin(url, callbackFn)
cy.origin(url, options, callbackFn)
```

### Usage<commit_msg>Update content/api/commands/origin.md<commit_after>---
title: origin
---

Visit multiple domains of different
[origin](https://developer.mozilla.org/en-US/docs/Web/Security/Same-origin_policy#definition_of_an_origin)
in a single test.

In normal use, a single Cypress test may only run commands in a single origin, a
limitation determined by standard web security features of the browser. The
`cy.origin()` command allows your tests to bypass this limitation.

<Alert type="warning">

<strong class="alert-header"><Icon name="exclamation-triangle"></Icon>
Experimental</strong>

The `cy.origin()` command is currently experimental and can be enabled by setting
the [`experimentalSessionAndOrigin`](/guides/references/experiments) flag
to `true` in the Cypress config.

Enabling this flag does the following:

- It adds the [`cy.session()`](/api/commands/session) and `cy.origin()`
  commands, and [`Cypress.session`](/api/cypress-api/session) API.
- It adds the following new behaviors (that will be the default in a future
  major version release of Cypress) at the beginning of each test:
  - The page is cleared (by setting it to `about:blank`).
  - All active session data (cookies, `localStorage` and `sessionStorage`)
    across all domains are cleared.
- It overrides
  the [`Cypress.Cookies.preserveOnce()`](/api/cypress-api/cookies#Preserve-Once) and
  [`Cypress.Cookies.defaults()`](/api/cypress-api/cookies#Defaults) methods.
- Cross-domain requests will no longer fail immediately, but instead, time out
  based on [`pageLoadTimeout`](/guides/references/configuration#Timeouts).
- Tests will no longer wait on page loads before moving on to the next test.

Because the page is cleared before each
test, [`cy.visit()`](/api/commands/visit) must be explicitly called in each test
to visit a page in your application.

</Alert>

## Syntax

```js
cy.origin(url, callbackFn)
cy.origin(url, options, callbackFn)
```

### Usage
{'fraction_non_alphanumeric': 0.11380840511615765, 'fraction_numerical': 0.0, 'mean_word_length': 4.850381679389313, 'pattern_counts': {'":': 0, '<': 15, '<?xml version=': 0, '>': 15, 'https://': 2, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1856824', 'n_tokens_mistral': 1175, 'n_tokens_neox': 1134, 'n_words': 413}