iframe에서 콜백 메소드를 호출하여 오프너에 값을 반환해야합니다.iframe의 콜백 메소드가 오프너에 값을 반환합니다.
나는 SqueezeBox에 정적 메서드를 할당하고, 열거 나 닫습니다. 그러나 어떻게 작동하는지 이해하지 못해서 제발 저를 도울 수 있습니까?
iframe에서 콜백 메소드를 호출하여 오프너에 값을 반환해야합니다.iframe의 콜백 메소드가 오프너에 값을 반환합니다.
나는 SqueezeBox에 정적 메서드를 할당하고, 열거 나 닫습니다. 그러나 어떻게 작동하는지 이해하지 못해서 제발 저를 도울 수 있습니까?
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>
자신을 대답
나는 오프너에서 콜백 메소드를 사용했다. 감사합니다. – Premier
. SqueezeBox 기능으로 해결했습니다. – Premier