473,800 Members | 2,613 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Site Unload?

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
Jul 23 '05
35 1829
How about defaulting to false, then setting to true with OnLoad, in essense
reversing the sense.

"rubikzube* " <th************ @gmail.com> wrote in message
news:11******** **************@ z14g2000cwz.goo glegroups.com.. .
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?

Jul 23 '05 #11
Ross M. Greenberg wrote on 14 dec 2004 in comp.lang.javas cript:

"Evertjan." <ex************ **@interxnl.net > wrote in message
news:Xn******** ************@19 4.109.133.29...
Ross M. Greenberg wrote on 14 dec 2004 in comp.lang.javas cript:
> Sigh. There has to be something for this!
[Please do not topost on usenet]

No, you cannot detect something that is not defined.

"leaving a site" in the logical sense has no meaning to me.


It may not be formally defined,


It is not about a "formal definition", but what YOU mean by it defined in
a technical complete way.
but how about "when the host changes"?


The host of what?
Of a browser page?

Talking IE, when you pass to another page with shift-clicking a link, you
have two pages. Do you define closing one of the pages as leaving a site?

Even if there is one browser page, pulling the mains plug is not
"detected".

=============== ==

Your misconception IMHO is, that, as long as a page is on a browser, you
are "connected" to the "host". This is not true. "Connected" does not
exist in the HTML world.

If your employer wants this,
it is your task as the specialist to explain his/her folly.

--
Evertjan.
The Netherlands.
(Please change the x'es to dots in my emailaddress)
Jul 23 '05 #12

"Evertjan." <ex************ **@interxnl.net > wrote in message
news:Xn******** ************@19 4.109.133.29...
Ross M. Greenberg wrote on 14 dec 2004 in comp.lang.javas cript:

"Evertjan." <ex************ **@interxnl.net > wrote in message
news:Xn******** ************@19 4.109.133.29...
Ross M. Greenberg wrote on 14 dec 2004 in comp.lang.javas cript:

> Sigh. There has to be something for this!

[Please do not topost on usenet]

No, you cannot detect something that is not defined.

"leaving a site" in the logical sense has no meaning to me.
It may not be formally defined,


It is not about a "formal definition", but what YOU mean by it defined in
a technical complete way.
but how about "when the host changes"?


The host of what?
Of a browser page?


if I'm at http://www.foo.bar/whatever.htm, then going to
http://www.yahoo.com


Talking IE, when you pass to another page with shift-clicking a link, you
have two pages. Do you define closing one of the pages as leaving a site?
Nope. Just going to a "new" site.
Even if there is one browser page, pulling the mains plug is not
"detected".


That's why I want to detect the address of the page I'm *about* to open,
check the root-site.host and trigger if there's no match.
Jul 23 '05 #13
On Tue, 14 Dec 2004 15:37:42 -0500, Ross M. Greenberg
<gr******@catsk ill.net> wrote:

Don't top-post and don't quote signatures!
"Michael Winter" <M.******@bluey onder.co.invali d> wrote in message
news:opsi0kwiy0 x13kvk@atlantis ...


[snip]
What are you trying to achieve, and why?


For a commercial site, I want to open a survey page when they exit from
the site from any page, but not as they transit along the site's many
pages.


I'm afraid I'll have to be blunt: why on Earth should I, or anyone else,
tell you how to do that?

Provide a link to the survey and ask, discreetly, for visitors to fill it
in. If they're willing to do it, they'll activate the link and take the
survey. If they're not willing, they'll get annoyed, close the window, and
may not come back.

Don't annoy your users. It's the sensible, and ethical, thing to do.

Mike

--
Michael Winter
Replace ".invalid" with ".uk" to reply by e-mail.
Jul 23 '05 #14

"Michael Winter" <M.******@bluey onder.co.invali d> wrote in message
news:opsi0o0f06 x13kvk@atlantis ...
On Tue, 14 Dec 2004 15:37:42 -0500, Ross M. Greenberg
<gr******@catsk ill.net> wrote:

Don't top-post and don't quote signatures!
"Michael Winter" <M.******@bluey onder.co.invali d> wrote in message
news:opsi0kwiy0 x13kvk@atlantis ...
[snip]
What are you trying to achieve, and why?


For a commercial site, I want to open a survey page when they exit from
the site from any page, but not as they transit along the site's many
pages.


I'm afraid I'll have to be blunt: why on Earth should I, or anyone else,
tell you how to do that?


Aside from the challenge?

Provide a link to the survey and ask, discreetly, for visitors to fill it
in. If they're willing to do it, they'll activate the link and take the
survey. If they're not willing, they'll get annoyed, close the window, and
may not come back.

Don't annoy your users. It's the sensible, and ethical, thing to do.

The survey in mind seeks to ask them directly what they liked or did not
like about the site. I'm seeing more than a few users leaving the site from
its home page. I need to find out why so I can fix what they don't like.
Jul 23 '05 #15
On Tue, 14 Dec 2004 17:35:33 -0500, Ross M. Greenberg
<gr******@catsk ill.net> wrote:

[Opening a survey when leaving a site]

Whilst it is technically possible, it won't actually serve much purpose
for the reason I mentioned previously: user's generally don't like having
a questionaire shoved in their face. Moreover, if you use a pop-up to
present this survey, every pop-up blocker in existence will prevent it
from appearing.

[snip]
The survey in mind seeks to ask them directly what they liked or did not
like about the site. I'm seeing more than a few users leaving the site
from its home page. I need to find out why so I can fix what they don't
like.


That might depend on your content. For example, users might be arriving
because your site appeared in a search result whilst they're looking for
some information. When they view your site, they may discover that you
don't provide what they were looking for, so they leave. Alternatively,
they may be unsure of whether your site is appropriate and for some reason
- bad navigation or unappealing appearance, for example - they're not
inclined to investigate further.

The people over at alt.www.webmaster might have a few suggestions.

Mike

--
Michael Winter
Replace ".invalid" with ".uk" to reply by e-mail.
Jul 23 '05 #16
Ross M. Greenberg wrote:
"Michael Winter" <M.******@bluey onder.co.invali d> wrote in message
news:opsi0o0f06 x13kvk@atlantis ...
On Tue, 14 Dec 2004 15:37:42 -0500, Ross M. Greenberg
<gr******@cat skill.net> wrote:

Don't top-post and don't quote signatures!

"Michael Winter" <M.******@bluey onder.co.invali d> wrote in message
news:opsi0kw iy0x13kvk@atlan tis...
[snip]

What are you trying to achieve, and why?

For a commercial site, I want to open a survey page when they exit from
the site from any page, but not as they transit along the site's many
pages.


I'm afraid I'll have to be blunt: why on Earth should I, or anyone else,
tell you how to do that?

Aside from the challenge?


You can take this "challenge" for as long as you want, and you will
still ultimately fail in the end. The browser has NO way to know where I
am going, unless its from a link within the page.

But tell us this.

Lets say I am on page234.html on your site.
I have page352.html bookmarked.
I click the page352.html bookmark.

Did I leave the site?

The answer is no but your script will fail to know that.
The survey in mind seeks to ask them directly what they liked or did not
like about the site. I'm seeing more than a few users leaving the site from
its home page. I need to find out why so I can fix what they don't like.


Then put the link on the main page. As was pointed out, if the user
wants to fill it out, they will. <sarcasm>If they don't, then popping up
a survey page will surely entice them to.</sarcasm>

Thats assuming that Scripting is enabled and that you can actually open
a survey page.

--
Randy
comp.lang.javas cript FAQ - http://jibbering.com/faq
Answer:It destroys the order of the conversation
Question: Why?
Answer: Top-Posting.
Question: Whats the most annoying thing on Usenet?
Jul 23 '05 #17
Ross M. Greenberg wrote on 14 dec 2004 in comp.lang.javas cript:
The host of what?
Of a browser page?


if I'm at http://www.foo.bar/whatever.htm, then going to
http://www.yahoo.com


That is no answer to my question. You are not going from one place to
another but your browser page is. But another pge can stay on the old
host. The host OF WHAT?

Talking IE, when you pass to another page with shift-clicking a link,
you have two pages. Do you define closing one of the pages as leaving
a site?


Nope. Just going to a "new" site.


Strange. Same objection as above. see below.
Even if there is one browser page, pulling the mains plug is not
"detected".


That's why I want to detect the address of the page I'm *about* to
open, check the root-site.host and trigger if there's no match.


Only by comparing domains in the code could this be accomlished.

It would be an infringement of browser security, if the code of your page
would be able to know the domain of the next page if typed in or
favoritized.

No one in his right mind would want that information to be sent back to
the server of the old page, because all privacy would be gone.

--
Evertjan.
The Netherlands.
(Please change the x'es to dots in my emailaddress)
Jul 23 '05 #18

"Randy Webb" <Hi************ @aol.com> wrote in message
news:lP******** ************@co mcast.com...
You can take this "challenge" for as long as you want, and you will
still ultimately fail in the end. The browser has NO way to know where I
am going, unless its from a link within the page.
I thought an event was triggered when a web page is about to be accessed --
aren't custom 404's generated locally for invalid URLs, for example?
But tell us this.

Lets say I am on page234.html on your site.
I have page352.html bookmarked.
I click the page352.html bookmark.

Did I leave the site?
If the http://<whatever> is the same, no. If different, yes.
The answer is no but your script will fail to know that.
The survey in mind seeks to ask them directly what they liked or did not
like about the site. I'm seeing more than a few users leaving the site from its home page. I need to find out why so I can fix what they don't like.
Then put the link on the main page. As was pointed out, if the user
wants to fill it out, they will. <sarcasm>If they don't, then popping up
a survey page will surely entice them to.</sarcasm>


But this was a means to get them to let me know *as* they leave, not when
they're still at/just arrived at the site.
Thats assuming that Scripting is enabled and that you can actually open
a survey page.


Well, yeah, there's that, too :-)
Jul 23 '05 #19

"Evertjan." <ex************ **@interxnl.net > wrote in message
news:Xn******** ***********@194 .109.133.29...
Ross M. Greenberg wrote on 14 dec 2004 in comp.lang.javas cript:
The host of what?
Of a browser page?
if I'm at http://www.foo.bar/whatever.htm, then going to
http://www.yahoo.com


That is no answer to my question. You are not going from one place to
another but your browser page is. But another pge can stay on the old
host. The host OF WHAT?


The pages stay at the host, obviously. The base of the URL can be considered
the host for these purposes, however.
Only by comparing domains in the code could this be accomlished.

It would be an infringement of browser security, if the code of your page
would be able to know the domain of the next page if typed in or
favoritized.
I had thought the address you were *about* to go to would be available until
the event (onunload) had finished.

No one in his right mind would want that information to be sent back to
the server of the old page, because all privacy would be gone.


Hadn't thought of that....
Jul 23 '05 #20

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

5
20857
by: Harry J. Smith | last post by:
I have written a Visual Basic program that does a long calculation and writes the results to disk as it runs. If I click the Close button the window closes but the program keeps running. How can I get the program to recognize that its window has been closed and quit running? -Harry http://home.netcom.com/~hjsmith
0
4090
by: razheev | last post by:
Hi, I have a Table which contains 1 million rows. I want to do an unload of the table and do some massaging (tranforming) of data and do a load to a different table where the column attributes are different. My question is 1) What options should I use to do a unload so that the unload is very fast using Platinum Fast unload. The table has many columns which defined as VARCHAR. 2)Is there a provision to convert the column values from...
2
10851
by: Lauren Hines | last post by:
Hello, I have read numerous post stating that the only way to unload an assembly (DLL in my case) is to create a separate AppDomain, load the assembly, then unload it by calling AppDomain.Unload. When trying to delete the DLL file I get an exception that access is denied. When trying to copy over the DLL file, I get an exception that it is being used by another process.
1
2654
by: hal | last post by:
I have an application that includes an activex component that consumes resources that must be released when the a page is unloaded. Toward this end I subscribe to the unload event of the body of my page in javascript. However, if I turn on smart navigation, any button that does a server.transfer fails to fire the javascript unload event.
1
2934
by: Hal | last post by:
My most sincere gratitude to anyone who can help me work around this! I have work that needs to be done in javascript on the client whenever a page is unloaded. To this end, I subscribe to the unload event (client side not server side) of the <body> HTML element through javascript.
19
1744
by: Jon Davis | last post by:
I'm reposting this because I really need some advice. I have a web app that makes many queries to the database on every page. In order to save development effort, I've consolidated all database querying to methods in a single static class, so whenever I need data, I pass a SQL string to a method and I am passed a datareader or else individual values (string, integer, etc). There is a horrible memory leak in this application. Just one...
3
3214
by: Gauthier Segay | last post by:
Hello, I've an application where all my pages implement a PAGE_CODE string property, this property is stored in HttpContext.Current.Items. In some page, I must persist data in session while the user perform operation on this page (postback navigation based). I also need to clean up the session data when the user leave the page (by a anyway). My question is about the Unload event, is it safe to use the unload
11
8659
by: Timofmars | last post by:
I'm try to Unload DB2 data from a table into a record sequential file on NT. I can an unload on Mainframe, but it doesn't seem to be an option in NT. In NT, all I can do is export/import. I can do a Load too, but not an Unload. I just want the only the data from the table in a record sequential file. Export seems only to give options to have a delimited line sequential file or a record sequential file where the data is preceeded by...
5
2927
by: =?Utf-8?B?QW5keQ==?= | last post by:
As per the question really. Not trying to stop them leaving, but just detect WHEN they leave the site
0
9691
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9551
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10279
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
9092
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7582
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5473
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5607
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4150
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3765
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.