2016-03-18 12 views

答えて

0

URLから「X-Frame-Options」というヘッダーを取得できます。
これはDENY,SAMEORIGINまたはALLOW-FROMを返します。

0

別のドメインからiframeにURLを読み込もうとすると、このようなことを試すことができます。

//get the iframe object 
var iframe = document.getElementById('Frame'); 


var iframeDocument; 


    try{ 

     //cross browser solution to get the iframe document 
     //of the iframe 
     iframeDocument = iframe.contentDocument || iframe.contentWindow.document; 

    } 
    catch(error){ 

     alert(error); 

    } 
+0

iframeが正しくロードされていてもエラーが表示されます – nootb

+0

@nootbどのようなエラーが表示されますか?それは私のために働いています。あなたのフレームのIDは何ですか?私の例ではFrameを使用しましたが、iframeのIDと一致するようにdocument.getElementById()パラメータを変更する必要があります。 –

+0

@noob iframeDocument = iframe.contentDocument ||を選択したとき何とか謝ります。 iframe.contentWindow.document;その部分をコピーして貼り付けて、ドキュメント部分の文字を切り抜いた。私は構文エラーを修正しました。あなたがチャンスを得たときにもう一度お試しください。 –

関連する問題