如何摆脱浏览器默认提示? 下面是我的 CoffeeScript 。
$(window).on 'beforeunload', (e) ->
e.preventDefault()
question = "<h4 class='text-center'>The actual changes for black/white list will be lost.</h4>"
bootbox.confirm question, (result) ->
if result
$.post url, () ->
window.location.reload()
最佳答案
您无法替换内置消息框。您所能做的就是使用插件(或编写您自己的逻辑),将其功能替换为可设置样式的 HTML 元素。
这意味着更改使用 alert
、confirm
等的 JavaScript 代码。
关于javascript - beforeunload 之前用自己的 jquery 替换默认提示,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/23681480/