关闭iframe时如何刷新父页面 – jquery

我需要在用户关闭iframe时刷新我的网页

var iframe = $('#layer-frame').contents(); iframe.find(".close").click(function(){ alert("test"); }); 

我有上面的代码似乎没有捕获我的点击事件。 如何添加页面刷新function..请帮忙

这是一些技巧 – 您可以尝试捕获帧冒泡点击事件 –

父页面

   testpage     

IFRAME

 
click

在iframe加载函数中编写代码:

 $('#layer-frame').load(function() { $(this).contents().find(".close").click(function(){ alert("test"); location.reload(true); }); }); 

试试这个

 var ifra = $('#layer-frame').contents(); ifra.find(".close").click(function(){ location.reload(true); // This will reload the current page });