I have parent page and child page. In child page body tag i have below code.

我有父页面和子页面。在子页面正文标记我有下面的代码。

<body onunload="window.g_autoclosed=true;if(window.opener&&window.opener.NavModelessClose){window.opener.NavModelessClose(window,false);}"> 

when i click on button in parent page, child page should close and call the onunload event.

当我点击父页面中的按钮时,子页面应该关闭并调用onunload事件。

The unload event is raising correctly in IE and FF. But it is not raising in chrome and safari.

unload事件在IE和FF中正确引发。但它并没有提高铬和野生动物园。

Please help me.

请帮帮我。

4 个解决方案

#1


12

Modern WebKit browsers don't necessarily fire the unload event at the moment where the page is hidden. This is done in order to allow improved caching.

现代WebKit浏览器不一定在隐藏页面时触发卸载事件。这样做是为了允许改进的缓存。

You might consider replacing the use of unload with the pagehide event.

您可以考虑使用pagehide事件替换unload的使用。

See this blog post for an in-depth discussion.

有关深入讨论,请参阅此博客文章。

更多相关文章

  1. JSON/Jave不更新innerHTML onClick事件。
  2. JavaScript中的事件详解
  3. 鼠标按下时是否可以防止鼠标光标离开页面
  4. 【JavaScript】案例一:使用JS完成注册页面表单校验
  5. OnClick事件只获取第一个动态创建的行/ id
  6. electron 将pc端(vue)页面打包为桌面端应用
  7. 从打印页面中删除网址并打印文本
  8. 如何在我的页面上以漂亮的格式显示JSON对象?(复制)
  9. 在contenteditable中的占位符—焦点事件问题

随机推荐

  1. android Toast大全(五种情形)建立属于你自
  2. android 应用移植到ophone 平台需注意
  3. 设置TextView文字居中
  4. Android 音视频汇总
  5. Android内嵌H5(1)
  6. Android学习笔记(2)---android字体风格设置
  7. 关于linearLayout的中 android:layout_we
  8. Android中Activity启动模式详解
  9. listview android:cacheColorHint,androi
  10. android的一些常用属性的说明