网站卸载? [英] Site Unload?

查看:69
本文介绍了网站卸载?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我希望有一个仅在网站停止时运行的onUnload,而不是在当前页面被卸载的时候运行。有什么想法吗?


谢谢!


Ross

I want to have an onUnload that runs only when the site is left, not when
the current page is unloaded. Any ideas?

Thanks!

Ross

推荐答案

有没有解决方案?


" Ross M. Greenberg" < GR ****** @ catskill.net>在消息中写道

新闻:10 ************* @ corp.supernews.com ...
Is there no solution?

"Ross M. Greenberg" <gr******@catskill.net> wrote in message
news:10*************@corp.supernews.com...
我想要一个onUnload仅在网站离开时运行,而不是在当前页面被卸载时运行。有什么想法吗?

谢谢!

Ross
I want to have an onUnload that runs only when the site is left, not when
the current page is unloaded. Any ideas?

Thanks!

Ross



你必须要知道在卸载客户端之前和

据我所知,没有内置的方式知道通过DOM。

我能想到的唯一方法完成此操作是在您网站的每个页面上设置isLeaving

标记,并将其默认为true。每当你导航到你网站的另一个页面时,你必须将它设置为假。

然后在卸载时你可以查看标志的状态。 br />

这种方法可能会变成每个页面上的屁股痛苦

(尽管你可能能够捕获大多数带有脚本的项目来追逐

down onSubmit onClick events)但我想不出更好的方法。

其他人吗?

You will have to know before the unload where the client is going and
as far as I know there is no built in way of knowing that via the DOM.
The only way I can think of accomplishing this is to set an "isLeaving"
flag on every page of your site and default it to true. Whenever you
navigate to another page in your site you will have to set it to false.
Then in the unload you can check to see the status of the flag.

This method will probably turn into pain in the ass to do on every page
(although you may be able to trap most items with a script to chase
down onSubmit onClick events) but I can''t think of a better way.
Anyone else?

Ross M. Greenberg于2004年12月14日在comp.lang.javascript中写道
Ross M. Greenberg wrote on 14 dec 2004 in comp.lang.javascript:
我希望有一个仅在网站已经离开,而不是在当前页面被卸载时。有什么想法?
I want to have an onUnload that runs only when the site is left, not when
the current page is unloaded. Any ideas?




"网站已离开没有定义,

[除非你有一个按钮说我庄严宣布离开网站]


使用服务器端ASP脚本你可以做点什么在

会话结束时在服务器上。这不是很可靠,对客户也没有影响。


-

Evertjan。

荷兰。

(请将我的电子邮件地址中的x'变为点数)



"site is left" is not defined,
[unless you have a button saying "I solemnly declare to leave the site"]

With serverside ASP scripting you could do something ON THE SERVER when a
session ends. This is not very reliable and has no effect on clientside.

--
Evertjan.
The Netherlands.
(Please change the x''es to dots in my emailaddress)


这篇关于网站卸载?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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