同一生成元ポリシーを無視しているとされるため、小さなWebサイトを作成するためにHTAを選択しました。これをテストするために、次の4つのiframeを使用して小さなテストサイトを作成しました。
iframe id = "google" src = "http://www.google.nl" application = "yes">
iframe id = "test" src = "test.html">
iframe id = "test2" src = "C: /test.html ">
iframe id =" test3 "src =" D:/test/test.html ">
コンテンツは、4つのiframeすべてで正確に表示されます。ただし、JSを使用してiframeの本体を取得すると、奇妙な問題が発生します。
$(document).ready(function(){
alert($( "#google")。contents()。find( "body")。html());
alert($( "#test")。contents() .find( "body")。html());
alert($( "#test2")。contents()。find( "body")。html());
alert($( "#test3")。contents ().find( "body")。html());
});
すべてのテストIDのアラートは、想定どおりに機能します。ただし、#googleの場合はundefinedを返します。
HTAを実行しているメインファイルはC:/some/directory/deep/in/test.htaにあります
私は何が間違っているのですか?