2011-05-23 39 views
2

我在InnovaStudio所见即所得编辑器(5.3)中有一个iframed“弹出式”窗口。它用于放置从导航到文本的链接。点击链接后,弹出窗口应该关闭。IE9和self.close()

此代码的工作,除了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();上角自己的关闭按钮。我试图重写代码使用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(); 
     } 
    } 
}); 
+0

您是否尝试过'window.close()' – Eduardo 2011-05-23 17:12:22

回答

2

我用console.log(self.close),并追查到InnovaStudio的这些行istoolbar.js代码:

me.rt.frm.contentWindow.closeWin=function() { 
    me.close(); 
}; 
me.rt.frm.contentWindow.close=function() { 
    me.close(); 
}; 

所以,认为IE9可能无法看到close()出于某种原因,我改变了我的代码,使用closeWin()

$('#InternalLinkSelector').find('a').click(function(e) { 
    e.preventDefault(); 
    $this = $(this); 
    (opener ? opener : openerWin).oUtil.obj.insertLink($this.attr('href'), $this.html(), null, null); 
    self.closeWin(); 
}); 

现在它的工作!

2

尝试window.close()代替self.close()

+0

'window.close()'的行为方式相同。 – Sonny 2011-05-23 17:47:22