Skip to content

Commit

Permalink
fix(promise-and-array): CORSとXHRについての注意を追加
Browse files Browse the repository at this point in the history
close  #273
  • Loading branch information
azu committed Nov 20, 2016
1 parent 02cfd0b commit 2ed4b22
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions Ch2_HowToWrite/promise-and-array.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,19 @@
少しイメージしにくいので、
まずは、通常のコールバックスタイルを使って複数のXHRを行う以下のようなコードを見てみます。

[WARNING]
.CROSについて
====
ブラウザにおけるXHRのリソース取得には、CORS(https://developer.mozilla.org/ja/docs/Web/HTTP/HTTP_access_control[Cross-Origin Resource Sharing])というセキュリティ上の制約が存在します。
次からのサンプルでは `http://azu.github.io/promises-book/json/comment.json` という `azu.github.io` ドメイン以下にあるリソースを取得する例が登場します。
ブラウザでは、同一ドメインではないリソースを許可なく取得することはできません。そのため、 次のサンプルコードは http://azu.github.io/promises-book/[http://azu.github.io/promises-book/]上でないと動作しないことに注意してください。
また、 http://httpbin.org/[httpbin.org] というドメインがリソース取得の例として登場します。
こちらは、同一ドメインでなくてもリソースの取得が許可されています。
====

=== コールバックで複数の非同期処理

[role="executable"]
Expand Down

0 comments on commit 2ed4b22

Please sign in to comment.