关闭浏览器窗口前调用URL [英] Call URL before closing of Browser Window

查看:84
本文介绍了关闭浏览器窗口前调用URL的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想在网页的unload-Function中调用一个URL,但在unload-function中,get请求不起作用。我的代码如下所示:

I want to call an URL in the unload-Function of a Webpage but in the unload-function the get request is not working. My code looks like this:

$(window).unload( function () { 
   jQuery.get("someurl")
} );

我们希望了解关闭某些用户操作记录的窗口。有可能吗?

We want to be informed about the closing of the window for some logging of user actions. Is it possible somehow?

如果我在jQuery.get()之后添加一个alert(),Get-Request有足够的时间来做这个,但那不是我们更喜欢什么。

If i add an alert() after the jQuery.get(), the Get-Request has enough Time, to do this, but that's not what we prefer.

推荐答案

使用: -

jQuery.ajax({url:"someurl", async:false})

这篇关于关闭浏览器窗口前调用URL的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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