문제

I have an iFrame which has several links on the page which is inside the iFrame.

From the outside document, how can I tell if the page in the iFrame has been redirected?

<body>
    <script>
        if(somePage.html has been redirected) {
            //do something
        }
    </script>

    <iframe src="somePage.html">...</iframe>
</body>
도움이 되었습니까?

해결책

Give the iframe an id and try putting an load() function in the document.ready() handler:

$(document).ready(function () {
    $("iframeID").load(function () {
        //iframe loaded
        alert(this.contentWindow.location);
    });
});
라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top