ページfile://localhost/Users/pistacchio/dev/epress/catflow/test_html/index.html
から、私は、IFRAMEにアクセスしようとすると、次の(CoffeeScriptの)コードを持っている:URLとフレームにアクセスするための安全でないJavaScriptの試み(同じドメイン!)
$('#ipad-viewport iframe').bind 'load',() ->
console.log $(this).contents().find('map')
(これは、以下のJavaScriptに変換しますが、私は、IFRAMEのページを待つ
(function() {
$('#ipad-viewport iframe').bind('load', function() {
return console.log($(this).contents().find('map'));
});
}).call(this);
をロードすると、その本体内の要素にアクセスしよう:私は、問題は)ここに依存しているとは思いません。 IFRAMEは次のように定義されているので、今
Unsafe JavaScript attempt to access frame with URL file://localhost/Users/pistacchio/dev/epress/catflow/test_html/catalogo/catalog/intro.html from frame with URL file://localhost/Users/pistacchio/dev/epress/catflow/test_html/index.html. Domains, protocols and ports must match.
:私は次のエラーを取得する
<iframe src="file://localhost/Users/pistacchio/dev/epress/catflow/test_html/catalogo/catalog/intro.html" width="1024" height="768"></iframe>
は私のページと同じドメイン内のiframe、またはその両方file://localhost
ませんか?なぜこの問題が発生していますか?
はああ、該当する場合、私はクローム18でこれをテストしてい
file://はJS/AJAXをテストするのに最適なラッパー/プロトコルではありません。 –
これはajaxリクエストではありません。サーバーサイドでの作業がないので、私はサーバー上で動作していません。 – pistacchio
ちょうどそれが動作するかどうかをテストする最良の方法は、サーバーで実行する –