关闭标签和模型后,我会在关闭确认消息后尝试确认消息 [英] I try confirmation message after closing tab and model come after close confirmation message

查看:86
本文介绍了关闭标签和模型后,我会在关闭确认消息后尝试确认消息的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

$(document).ready(function(){

var myEvent = window.attachEvent || window.addEventListener;

var chkevent = window.attachEvent?' ':'beforeunload'; ///使IE7,IE8兼容



myEvent(chkevent,function(e){// For> = IE7,Chrome,Firefox

var confirmationMessage = $('#myModal')。modal('show'); //空格

(e || window.event).returnValue = confirmationMessage ;

返回确认消息;

});

});



我尝试了什么:



i想要先确认,当我点击停留在页面上然后会出现模型,但它无法正常工作mozilla发生的事情都来自mozilla的同时模型和确认,它在chrome plz工作帮助我..

解决方案

('#myModal')。modal('节目'); //空格

(e || window.event).returnValue = confirmationMessage;

return confirmationMessage;

});

});



我尝试过:



i想要第一次确认,当我点击停留在页面然后将来模型但它在mozilla中无法正常工作发生了同时模型和mozilla中的确认并且它在chrome plz工作帮助我..

beforeunload事件非常严格。在IE / Edge中,您所能做的就是通过从事件处理程序返回自定义消息来显示它。在Firefox和Chrome中,您甚至无法做到这一点 - 您返回的任何自定义消息都将被忽略,浏览器将显示其标准数据可能丢失消息。



您当然无法打开窗口或显示模态对话框。如果可以的话,互联网上的每个恶意网站都会阻止您离开页面。



坚持从事件处理程序返回一个简单的字符串。允许它的浏览器将显示您的消息,而不显示消息的浏览器将显示标准消息。


$(document).ready(function(){
var myEvent = window.attachEvent || window.addEventListener;
var chkevent = window.attachEvent ? '' : 'beforeunload'; /// make IE7, IE8 compitable

myEvent(chkevent, function(e) { // For >=IE7, Chrome, Firefox
var confirmationMessage = $('#myModal').modal('show'); // a space
(e || window.event).returnValue = confirmationMessage;
return confirmationMessage;
});
});

What I have tried:

i want to first confirmation, and when i click stay on page then will come model but it not working properly in mozilla what happen both are come same time model and confirmation in mozilla and it working in chrome plz help me..

解决方案

('#myModal').modal('show'); // a space
(e || window.event).returnValue = confirmationMessage;
return confirmationMessage;
});
});

What I have tried:

i want to first confirmation, and when i click stay on page then will come model but it not working properly in mozilla what happen both are come same time model and confirmation in mozilla and it working in chrome plz help me..


The "beforeunload" event is very restrictive. In IE / Edge, all you can do is display a custom message by returning it from the event handler. In Firefox and Chrome, you can't even do that - any custom message you return will be ignored, and the browser will display its standard "data may be lost" message instead.

You certainly can't open windows or display modal dialogs. If you could, every malicious site on the Internet would do it to prevent you from leaving the page.

Stick with returning a simple string from your event handler. Browsers which allow it will display your message, and those that don't will display a standard message instead.


这篇关于关闭标签和模型后,我会在关闭确认消息后尝试确认消息的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆