【发布时间】:2011-03-20 04:23:58
【问题描述】:
有没有办法做到这一点,如果 iframe 内的页面不是 src,那么它会将父页面更改为 iframe 试图去的 url?像这样的:
<script>
function redir() {
if(document.getElementById("myiframe").src != 'http://www.google.com'){
window.location = document.getElementById("myiframe").location
}
}
</script>
<iframe src="http://www.google.com/" id="google" onload="redir()"></iframe>
【问题讨论】:
标签: url iframe redirect location parent