「Unity/WebGL/API」の版間の差分
提供: 初心者エンジニアの簡易メモ
(ページの作成:「=='Access-Control-Allow-Origin'エラーが出る場合== エラー詳細 has been blocked by CORS policy: No 'Access-Control-Allow-Origin' header is present on the requ...」) |
(相違点なし)
|
2023年1月5日 (木) 16:54時点における最新版
'Access-Control-Allow-Origin'エラーが出る場合
エラー詳細
has been blocked by CORS policy: No 'Access-Control-Allow-Origin' header is present on the requested resource. If an opaque response serves your needs, set the request's mode to 'no-cors' to fetch the resource with CORS disabled.
phpであれば
header("Access-Control-Allow-Origin: *"); header("Access-Control-Allow-Methods: GET, POST, OPTIONS, PUT, DELETE"); header("Access-Control-Allow-Headers: Content-Disposition, Content-Type, Content-Length, Accept-Encoding"); header("Content-type:application/json");