我在 InnovaStudio 所见即所得编辑器 (5.3) 中有一个 iframed“弹出”窗口。它用于将导航链接放置到文本中。单击链接后,弹出窗口应关闭。
此代码适用于除 Internet Explorer 9 之外的所有浏览器:
$('#InternalLinkSelector').find('a').click(function(e) {
e.preventDefault();
$this = $(this);
(opener ? opener:openerWin).oUtil.obj.insertLink($this.attr('href'), $this.html(), null, null);
self.close();
});
弹出窗口在调用 ISWindow.objs['
UNIQUE_ID_STRING'].close();
的上 Angular 有自己的关闭按钮。我尝试重写代码以使用 ISWindow
,但它表现出相同的行为,适用于除 IE9 之外的所有浏览器:
$('#InternalLinkSelector').find('a').click(function(e) {
e.preventDefault();
$this = $(this);
(opener?opener:openerWin).oUtil.obj.insertLink($this.attr('href'), $this.html(), null, null);
// Find the window object to close it
for (var i in top.ISWindow.objs) {
if ('function' == typeof top.ISWindow.objs[i].close) {
top.ISWindow.objs[i].close();
}
}
});
最佳答案
尝试使用 window.close()
而不是 self.close()
关于javascript - IE9 和 self.close(),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/6100451/