js 监听 iframe url变化
问题场景再现:
解决思路:
<iframe scrolling="auto" frameborder="0" src="' + url + '" style="width:100%;height:100%;" onload="loadFrame(this)"></iframe> function loadFrame(obj){ var url = obj.contentWindow.location.href; if(url.indexOf("login.jsp")!=-1){ window.location.href = "/login.jsp"; } }