2012-05-31 3 views
1

Google 웹 사이트 (www.example.com)에서 api 서버 (api.example.com)로 iframe을 통해 전화를 겁니다.iframe src url 의도하지 않게 부모 URL 변경

iframe 소스 URL은 부모 창 URL을 iframe 소스 URL로 변경합니다. 아래

<iframe onload="iframeManager.tempIframeCallback()" id="xd_iframe" allowtransparency="true" frameborder="0" scrolling="no" tabindex="0" name="xd_iframe" style="position:absolute;top:-9999em;width:10px;height:10px;" src= "{{html on api server}}"> 
     </iframe> 

이 API를 서버의 HTML입니다 : 아래의 iframe이 코드

<?xml version="1.0" encoding="UTF-8"?> 
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> 
     <title>xyz</title> 

    <body> 
    <script type="text/javascript" charset="utf-8"> 
     document.domain='example.com'; 
    </script> 
    </body> 
</html> 

참조 : http://fettig.net/weblog/2005/11/28/how-to-make-xmlhttprequest-connections-to-another-server-in-your-domain/

+0

iframe을 사용하는 이유는 무엇입니까? 왜 페이지/데이터를로드하기 위해 아약스 호출을하지 않습니까? –

+0

참조를보십시오. –

답변