当我尝试关闭未保存的更改我的谷歌文档选项卡上,这是我在我的浏览器(FF 3.5)获得。
When I try to close my Google docs tab with unsaved changes, this is what I get in my browser (FF 3.5).
您确定要离开 从这个页面?
Are you sure you want to navigate away from this page?
您在这个未保存的更改 文件。点击立即取消,那么 保存来拯救他们。现在就点击确定 丢弃它们。
You have unsaved changes in this document. Click Cancel now, then 'Save' to save them. Click OK now to discard them.
preSS确定继续,或取消 留在当前页面。
Press OK to continue, or Cancel to stay on the current page.
我的问题是这样的警报是否是Web应用程序(gdocs为如)的一部分,或者它们是由浏览器给出了?如果后者,这是怎么做的?
My question is whether such alerts are part of the web app (gdocs for eg.) or are they given out by the browser? If latter, how is this done?
推荐答案浏览器。这是 beforeunload 事件处理函数返回的对话框,这是只有三段的中间的自定义文本 - 其他两款,以及按钮的文字不能定制或以其他方式改变了。
By the browser. It's the beforeunload event handler that returns the customized text of the dialog, which is only the middle of the three paragraphs - the other two paragraphs as well as the text of the buttons cannot be customized or otherwise changed.
window.onbeforeunload = function(){ return 'Testing...' }将产生一个对话框,说:
Will yield a dialog that says
Are you sure you want to navigate away from this page? Testing... Press OK to continue, or Cancel to stay on the current page.您可以通过设置处理器为null抵消这种
You can nullify this by setting the handler to null
window.onbeforeunload = null;更多推荐
从网页导航离开时,警报
发布评论