0

I'd like to use window.location.href in the tool codesandbox.io. This is because I want to do a test with a hard page load occurring. I'm running into an issue however.

location.href = "http://www.google.com"

I get this error:

Mixed Content: The page at 'https://codesandbox.io/s/lingering-bird-nyvfi' was loaded over HTTPS, but requested an insecure resource 'http://www.google.com/'. This request has been blocked; the content must be served over HTTPS.

Example: https://codesandbox.io/s/locationhref-usage-nyvfi (see src/index.ts and open Dev Console)

How do I accomplish this the ability to simulate a page load, in the fake virtual browser?

Michael R
  • 1,547
  • 1
  • 19
  • 27
  • Go to an HTTPS page like `https://www.google.com/` I guess – Ry- May 31 '19 at 01:22
  • Thanks. However I received a new error: ``` Refused to display 'https://www.google.com/' in a frame because it set 'X-Frame-Options' to 'sameorigin'. ``` – Michael R May 31 '19 at 17:25

1 Answers1

0

I think it may be possible once the security criteria are met; which is limiting.

  • Use HTTPS (Avoid mixed content)
  • Use same origin

Thus this works:

window.location.href = "https://www.codesandbox.io/docs";
Michael R
  • 1,547
  • 1
  • 19
  • 27