[JavaScript] Cross origin requests are only supported for protocol schemes: http, data, chrome, chrome-extension, https, chrome-extension-resource.

ローカル環境でローカルにある JSON ファイルを $.getJSON しようとすると Chrome では file スキーマは読み込んでくれなくてエラーが発生します。

JavaScript

var jsonFilePath = "./json/sample.json";
 
$.getJSON(jsonFilePath, function(data){
  // do something
});

エラーメッセージ

XMLHttpRequest cannot load file:///Users/username/Downloads/hoge.json.
Cross origin requests are only supported for protocol schemes:
http, data, chrome, chrome-extension, https, chrome-extension-resource.

ステージングサーバに設置して http 経由で確認するしかなさそうです。

簡単に確認する方法だと DropBox の Public ディレクトリに設置して、https://dl.dropboxusercontent.com/u/xxx/index.html とかいう URL でアクセスすることで確認できます。

参考情報