奇妙な問題に遭遇しましたが、何が問題なのかわかりません。次のjQueryコードは、私が達成したいことの単純化されたバージョンです。
var iframe = $('<iframe />');
iframe.prop('src', 'https://maps.google.com/maps?q=London&hl=en&sll=37.0625,-95.677068&sspn=46.677964,93.076172&t=h&hnear=London,+United+Kingdom&z=10');
iframe.appendTo($('body'));
// When the iframe loads:
iframe.load(function() {
alert(1);
});
マップがロードされることはなく、load()
イベントがトリガーされることもありません。Chromeは次のエラーを報告します:
Refused to display 'https://maps.google.com/maps?q=London&hl=en&sll=37.0625,-95.677068&sspn=46.677964,93.076172&t=h&hnear=London,+United+Kingdom&z=10' in a frame because it set 'X-Frame-Options' to 'SAMEORIGIN'.
これをどのように回避しますか?
これがjsFiddleのデモです。