失眠网,内容丰富有趣,生活中的好帮手!
失眠网 > header is present on the requested resource. Origin 'null' is therefore not allowed access.

header is present on the requested resource. Origin 'null' is therefore not allowed access.

时间:2022-09-25 13:41:19

相关推荐

header is present on the requested resource. Origin 'null' is therefore not allowed access.

No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'null' is therefore not allowed access.解决方案

1,如果请求的url是PHP页面,则需要在PHP页面中添加代码:header("Access-Control-Allow-Origin: *");

2,如果请求的url是静态的html页面,则需要在页面中添加meta标签代码:<meta http-equiv="Access-Control-Allow-Origin" content="*" />

3,如果服务器端可以确定是要被哪些域名访问,最好是能把以上代码中的“*”代替为具体的域名,这样做可以相应的增强安全性。

4,最终代码与请求数据如下

如果觉得《header is present on the requested resource. Origin 'null' is therefore not allowed access.》对你有帮助,请点赞、收藏,并留下你的观点哦!

本内容不代表本网观点和政治立场,如有侵犯你的权益请联系我们处理。
网友评论
网友评论仅供其表达个人看法,并不表明网站立场。