【发布时间】:2012-09-19 06:38:25
【问题描述】:
我正在可编辑的表格中显示某些记录。用户在编辑记录时尝试重新加载表格时,会弹出一个警告该记录有关未保存数据的记录。
function cancelProcess()
{
if(noEditedRecords !=0)//number of edited records in the table
{
var processConfirmation = confirm("You've Edited "+ noEditedRecords +" Records. Are You sure to undo the Changes made?");
if (processConfirmation ==true){
window.onbeforeunload = null;
window.location.reload();
}
}
}
当他点击确定重新加载页面时,Firefox 提示为
要显示此页面,Firefox 必须发送重复之前执行的任何操作(例如搜索或订单确认)的信息。
并且在Chrome中打开同一个页面时,没有出现这样的提示。
我试图通过设置window.onbeforeunload = null; 来避免这种情况,但仍然会出现提示窗口。
我也尝试通过更改 Firefox 配置:
browser.sessionstore.postdata
按照 Mozilla 支持页面中的建议将 0 更改为 1。
但没有任何效果..如何防止提示?
【问题讨论】:
-
我感觉你需要的和你要求的不一样。你有机会展示你的代码吗?
-
@JesseJ 已包含代码..
标签: javascript firefox google-chrome reload onbeforeunload