2010-01-15 8 views

답변

1

SqueezeBox에 대해 많이 알지는 못하지만 iframe 통신에 대한 일부 작업을 수행했습니다. iFrame과 오프너가 같은 도메인에 있지 않으면 상대방에게 전화를 걸 수 없습니다.

이 문제를 해결하기 위해 수행 한 작업은 URL 해시에 기록하는 것입니다. 오프너는이 값을 읽고 무엇을해야할지 파악할 수 있습니다. 예를 들어

,

<iframe name="my-frame" id="my_frame" src="http://www.somewhere.com" width="540" height="1000" border="0" style="overflow:hidden; border: none;"> 
    <script type="text/javascript">window.location.hash = 'close';</script> 
</iframe> 

<script type="text/javascript"> 

    // Function to look for a token in the url hash 
    var tokenValue = function(){ 
    var hash = document.location.hash; 
    return (hash && hash.length > 1) ? hash.substring(1, hash.length) : null; 
    }; 

    // Function to set the token and notify the user when it is found in the url hash. 
    var checkForToken = function(){ 
    if (tokenValue()) { 
     alert(tokenValue()); 
     $clear(periodical); 
    } 
    }; 

    // Start a periodical that will check for 
    var periodical = checkForToken.periodical(100); 
</script> 
자신을 대답
+0

나는 오프너에서 콜백 메소드를 사용했다. 감사합니다. – Premier

관련 문제