使用location.href时,为什么我总是被CORS阻止

问题描述 投票:-3回答:1

尝试从我的域重定向到另一个域时,我遇到了一个奇怪的错误。这是我想要做的:

location.href="https://paystack.com/secure/xxx"

这是错误:

Failed to load https://paystack.com/secure/xxx: Response to preflight request doesn't pass access control check: No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'http://localhost:59610' is therefore not allowed access

我能做些什么才能通过这个?

javascript cors
1个回答
-3
投票

我终于搞定了。这就是我做的

window.location.replace('domain');
window.location.href ='domain'
© www.soinside.com 2019 - 2024. All rights reserved.