如何在 iframe 本身内关闭 iframe [英] How to close an iframe within iframe itself

查看:121
本文介绍了如何在 iframe 本身内关闭 iframe的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何使用 javascript 或 jQuery 关闭 iframe 本身内的 iframe?我试过 <a href="javascript:self.close()"> 但它没有用.

How do I use javascript or jQuery to close an iframe within iframe itself? I've tried <a href="javascript:self.close()"> but it didn't work.

推荐答案

关闭"当前 iFrame 是不可能的,但您可以告诉父级操作 dom 并使其不可见.

"Closing" the current iFrame is not possible but you can tell the parent to manipulate the dom and make it invisible.

在 IFrame 中:

In IFrame:

parent.closeIFrame();

在父级中:

function closeIFrame(){
     $('#youriframeid').remove();
}

这篇关于如何在 iframe 本身内关闭 iframe的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆