当离开页面时,此功能在单击刷新或关闭页面时有效。当用户单击后退按钮时,它不起作用。有谁知道为什么这不能用后退按钮?
DB::table('table')
->where('column', 'operator', 'value')
->orWhere(function($query)
{
$query->where('column', 'operator', 'value')
->where('column', 'operator', 'value');
})
->get();
这是HTML:
<script>
function PopIt() {
$("a.trigger").trigger('click');
window.onbeforeunload = UnPopIt;
return "Your changes have not been saved.";
}
function UnPopIt() { /* nothing to return */ }
window.onbeforeunload = PopIt;
$(document).ready(function () {
$("a[id!=trigger]").click(function () { window.onbeforeunload = PopIt;});
});
</script>