Iframe:修订间差异

来自康健生活
Kangkk​(留言 | 贡献)
Kangkk​(留言 | 贡献)
第12行: 第12行:


需要在微信接口配置参数中设置 <code>self_redirect:false</code>
需要在微信接口配置参数中设置 <code>self_redirect:false</code>
== 事件 ==
=== IE ===
<syntaxhighlight lang="javascript">
iframeRef?.contentDocument?.addEventListener('readystatechange', iframeHandleListener, {passive: false});
</syntaxhighlight>
=== 非 IE ===
<syntaxhighlight lang="javascript">
iframeRef?.contentDocument?.addEventListener('load', iframeHandleListener, {passive: false});
</syntaxhighlight>

2022年2月24日 (四) 10:04的版本

跳转

向父级跳转

iframe 在登录页面中加入下面的代码,就会在最外层页面跳转

<script language="JavaScript"> 
if (window != top) 
top.location.href = location.href; 
</script>

微信登陆

在做微信登陆的时候遇到,微信扫描二维码,但是跳转只在 iframe 中跳转,没有跳到父级。

需要在微信接口配置参数中设置 self_redirect:false

事件

IE

iframeRef?.contentDocument?.addEventListener('readystatechange', iframeHandleListener, {passive: false});

非 IE

iframeRef?.contentDocument?.addEventListener('load', iframeHandleListener, {passive: false});