title: Cypress detects cross origin error on test that does not leave main origin
body: <p>I've been running into a problem with Cypress (currently v8.3.1 but this has been a constant for years) where my test detects a cross origin error on page load, but I am 99% certain that shouldn't apply.</p>
  <p>The test logs into a web application and attempts to access a project.</p>
  <pre><code>cy.visit(webapp)                     //login page
  cy.login(userCreds)                  //enter user cred and access main page
  cy.get(projectAcccessButton).click() //access project from main
  </code></pre>
  <p>As the project page loads, Cypress throws the cross origin error below. I've been using the <code>&quot;chromeWebSecurity&quot;: false</code> workaround, but it does not apply to Firefox. Firefox test coverage is on the &quot;2022 To Do&quot; list, so I am turning to Stack for answers - I hope.</p>
  <p>What I want to do: Access the project page without issue.</p>
  <p>What has been happening: cross origin error on page load</p>
  <blockquote>
  <p>Permission denied to access property &quot;document&quot; on cross-origin object</p>
  </blockquote>
  <p>I mentioned that the cross origin error likely shouldn't apply because when I modify the test to access the project page via <code>cy.visit()</code>, Cypress does not throw an error.</p>
  <pre><code>cy.visit(webapp)                     //login page
  cy.login(userCreds)                  //enter user cred and access main page
  cy.visit(projectPage)                //access project via url
  </code></pre>
  <p>This leads me to believe something is happening on the button click that is somehow triggering the cross origin error. Is it possible that the button attribute <code>onclick=&quot;window.location.href='/projectManager/123456789'&quot;</code> is somehow being interpreted as leaving the main origin?</p>
  <p>If this error is related to the <code>window.location.href</code>, how can I resolve this so Cypress doesn't detect an error when running in Firefox?</p>
  <p>Full Error Message:</p>
  <p><a href="https://i.stack.imgur.com/1t2qV.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/1t2qV.png" alt="CypressError" /></a></p>