我想在工具codeandbox.io中使用window.location.href
。这是因为我想对硬页加载进行测试。但是我遇到了一个问题。
location.href = "http://www.google.com"
我收到此错误:
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.
示例: https://codesandbox.io/s/locationhref-usage-nyvfi(请参见src/index.ts
并打开开发控制台)
我如何在假的虚拟浏览器中实现模拟页面加载的功能?
答案 0 :(得分:0)
我认为,一旦满足安全标准,这就有可能。这是限制性的。
因此可行:
window.location.href = "https://www.codesandbox.io/docs";