AJAX and onbeforeunload event
AJAX and onbeforeunload event
>我有一个aspx页面。在页面上,我有一个javascript函数
window.onbeforeunload = confirmExit;
function confirmExit()
{
return "You have attempted to leave this page. If you have made any changes to the fields without clicking the Submit button, your changes will be lost. Are you sure you want to exit this page?";
}
这将在用户离开页面时执行。但是,它也在部分页面回发上执行。如何检查这是否是部分页面回发并忽略它?
我可以防止在执行 AJAX 调用时调用 window.onbeforeunload
查看您正在执行的操作是否执行以下任何操作:
在卸载之前事件
若要调用此事件,请执行下列操作之一:
- 关闭当前窗口。
- 通过输入新地址或选择收藏夹导航到其他位置。
- 单击引用另一个文档的锚点。
- 调用 anchor.click 方法。
- 调用 document.write 方法。
- 调用 document.close 方法。
- 调用 window.close 方法。
- 调用 window.navigate 或 NavigateAndFind 方法。
- 调用 location.replace 方法。
- 调用 location.reload 方法。
- 为 location.href 属性指定一个新值。
- 将表单提交到中指定的地址通过 INPUT type=submit 控件的 ACTION 属性,或调用表单提交方法。
- 调用 window.open 方法,提供窗口名称的可能值_self。
- 调用 document.open 方法。
- 单击"后退"、"前进"、"刷新"或"主页"按钮。
相关文章:
- issue with FB.Event.subscribe
- Angularjs :$routeChangeStart event
- event.prventDefault()持续多久
- onbeforeunload和asp:Safari和FireFox中的更新面板
- <text区域>在我的html中包含event.keycode==13之后,wrap就不起作用了
- KeyDown event for CKeditor
- Javascript events: window.event vs argument reference (funct
- 动态填充Bootstrap选择选择器:change event dos'不起作用
- <td> focusin event .addclass
- 从window.onbeforeunload调用方法背后的代码
- 如何显示window.onbeforeunload警报的引导模式
- onbeforeunload未正确触发
- event.preventDefault阻止ajax调用
- google.maps.event.addDomListener(window, 'load', fun
- jQuery event.target is_a_child_of(element)
- onbeforeunload事件在我的代码中没有触发,但其他示例可以工作
- event.stopPropagation()在firefox javascript中不起作用
- asp.net text onkeyup event
- javascript onbeforeunload then onunload event
- AJAX and onbeforeunload event