页面卸载事件无法在Google Chrome中使用 [英] Page Unload Events not working in Google Chrome
问题描述
嗨..朋友我有重大问题我想在页面卸载时进行一些编码而页面卸载假设用户关闭浏览器或关闭页面。我使用以下代码:
< script src = http://code.jquery.com/jquery-latest.js>< / script>
< script type = text / javascript>
$( window )。unload( function (){
alert(< span class =code-string>' Baye!');
});
< / script>
我正在使用jQuery它运行得非常好mozila firefox但不适用于Google Chrome。有人请告诉我如何解决这个问题。
提前致谢
Parveen Rathi
( window )。卸载( function (){
alert(' Baye!');
});
< / script>
我正在使用jQuery它运行得非常好mozila firefox但不适用于Google Chrome。有人请告诉我如何解决这个问题。
提前致谢
Parveen Rathi
< blockquote>试试这个,
请尝试使用Window.onbeforeunload,并注意它在关闭页面之前使用''return''来提示消息
< script type =text / javascript>
window.onbeforeunload =来电;
函数Call(){
// alert(Unload Callled);
返回您的留言;
}
< / script>
Hi.. Friends I have major problem I want to do some coding on page unload event while page is unload suppose user close the browser or close the page. I am using the following code :
<script src="http://code.jquery.com/jquery-latest.js"></script>
<script type="text/javascript">
$(window).unload(function () {
alert('Baye !');
});
</script>
I am using jQuery it is working very well mozila firefox but not working in Google chrome. Is anybody please tell me how can I conflict this problem.
Thanks in Advance
Parveen Rathi
(window).unload(function () { alert('Baye !'); }); </script>
I am using jQuery it is working very well mozila firefox but not working in Google chrome. Is anybody please tell me how can I conflict this problem.
Thanks in Advance
Parveen Rathi
Try out this,
Please try to use Window.onbeforeunload, and note that it use ''return'' to prompt message before closing the page
<script type="text/javascript"> window.onbeforeunload = Call; function Call() { //alert("Unload Callled"); return "Your Message"; } </script>
这篇关于页面卸载事件无法在Google Chrome中使用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!