Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/html/85.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Html 在iframe中检测重定向_Html_Angular_Typescript_Iframe - Fatal编程技术网

Html 在iframe中检测重定向

Html 在iframe中检测重定向,html,angular,typescript,iframe,Html,Angular,Typescript,Iframe,我需要检测iframe何时没有收到它请求的内容,而是被重定向到登录页面 iframe是否处理重定向,或者这是由浏览器完成的? 是什么让我这么认为的:load事件只会触发一次,即使之后它的src属性仍然设置为原始URL。假设相同的来源,在给定此测试时,您有以下两种方法: function isFramed() {try {return window.self !== window.top;} catch (e) {return true;}; 这个 或 或者查看如果在同一来源,让登录页面告诉家

我需要检测iframe何时没有收到它请求的内容,而是被重定向到登录页面

iframe是否处理重定向,或者这是由浏览器完成的?
是什么让我这么认为的:load事件只会触发一次,即使之后它的src属性仍然设置为原始URL。

假设相同的来源,在给定此测试时,您有以下两种方法:

function isFramed() {try {return window.self !== window.top;} catch (e) {return true;}; 
这个


或者查看

如果在同一来源,让登录页面告诉家长,或者让登录页面在加载时重定向到_top对不起,你能进一步解释吗?
函数isFramed(){try{return window.self!==window.top;}catch(e){return true;};If(isFramed)window.open(location.href,“_top”);
函数isFramed(){try{return window.self!==window.top;}catch(e){return true;};if(isFramed)parent.doSomethingHenloginisFramed()
如果控制iFrame的内容,可以使用postMessage标准:
if (isFramed) window.open(location.href,"_top"); 
if (isFramed) parent.doSomethingWhenLoginIsFramed();