473,747 Members | 2,886 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Alert when leaving site.

Ive seen alert scripts triggered by links but I need one that will cover any
link or pressing the back/forward buttons.

Any such thing?

TIA

Jul 23 '05 #1
9 7562
<body onUnload="alert ('bye')">
Test it on NS7 too, I never tested on it. Doesn't work on NS4.
ciao
Alberto
http://www.unitedscripters.com/


"Targa" <ta************ ***********@all tel.net> ha scritto nel messaggio
news:kG******** *****@fe39.usen etserver.com...
Ive seen alert scripts triggered by links but I need one that will cover any link or pressing the back/forward buttons.

Any such thing?

TIA

Jul 23 '05 #2
Thanks but this would cause an alert even when going to pages within the
site.

Any way to use this but only when the user leaves the site/domain?

Thanks.


"Alberto" <no****@nospam. nospam> wrote in message
news:4k******** **************@ news3.tin.it...
<body onUnload="alert ('bye')">
Test it on NS7 too, I never tested on it. Doesn't work on NS4.
ciao
Alberto
http://www.unitedscripters.com/


"Targa" <ta************ ***********@all tel.net> ha scritto nel messaggio
news:kG******** *****@fe39.usen etserver.com...
Ive seen alert scripts triggered by links but I need one that will cover

any
link or pressing the back/forward buttons.

Any such thing?

TIA



Jul 23 '05 #3
Targa wrote:
Thanks but this would cause an alert even when going to pages within the
site.
Yup, that it does.
Any way to use this but only when the user leaves the site/domain?
No, not an infallible way. You could set an onclick in each link that
sets a variable to false, onunload check that variable. If its false, no
alert. If its true, alert.

The fallibility of that?

Lets say I am on page1.html of your site, and I have page31.html saved
in my Favs and I click on the faves to get straight to page31.html
instead of having to browse your site. There is *no* way to know I did
that from the browser/page perspective. Hence the "not infallibly".
Thanks.


Welcome.

--
Randy
comp.lang.javas cript FAQ - http://jibbering.com/faq
Jul 23 '05 #4
Targa <ta************ ***********@all tel.net> wrote:
Ive seen alert scripts triggered by links but I need one that will cover any
link or pressing the back/forward buttons.

Any such thing?


If there was, I'd want it disabled by default in my browser.
What's the first thing that many sites would do if they could do
actions on the "back" button.
Jul 23 '05 #5
you can append a query string to your links except to the front page. Upon
unload if the query string is not there it fires the alert. But honestly not
worth the toil lol
ciao
Alberto

"Targa" <ta************ ***********@all tel.net> ha scritto nel messaggio
news:hN******** *******@fe39.us enetserver.com. ..
Thanks but this would cause an alert even when going to pages within the
site.

Any way to use this but only when the user leaves the site/domain?

Thanks.


"Alberto" <no****@nospam. nospam> wrote in message
news:4k******** **************@ news3.tin.it...
<body onUnload="alert ('bye')">
Test it on NS7 too, I never tested on it. Doesn't work on NS4.
ciao
Alberto
http://www.unitedscripters.com/


"Targa" <ta************ ***********@all tel.net> ha scritto nel messaggio
news:kG******** *****@fe39.usen etserver.com...
Ive seen alert scripts triggered by links but I need one that will
cover any
link or pressing the back/forward buttons.

Any such thing?

TIA



Jul 23 '05 #6
Alberto wrote:
you can append a query string to your links except to the front page. Upon
unload if the query string is not there it fires the alert. But honestly not
worth the toil lol


Thats not only not worth the toil, it won't work.

--
Randy
comp.lang.javas cript FAQ - http://jibbering.com/faq
Jul 23 '05 #7
ahhhhhh, a rebuttal....
Well Randy, I do that on my website, though I don't fire an alert by that
but I do another thing; guess what: it works.

If you don't know how to do a thing, don't jump on those who hint they do
it.
When I don't understand something, I at most ask cfor clarification, I
never, never draw a conclusion, especially if it is just to add a stupid
comment to a person who was trying to provide some help to a THIRD person.

Never rebuttals, Randy. Never. Didn't mom tell you, after so many years on
this group?

N E V E R rebuttals - they cause problems. And as I said, not only it is
not worth the toil, but if you take the toil, it W_O_R_K_S.

goodnight
"Randy Webb" <Hi************ @aol.com> ha scritto nel messaggio
news:QN******** ************@co mcast.com...
Alberto wrote:
you can append a query string to your links except to the front page. Upon unload if the query string is not there it fires the alert. But honestly not worth the toil lol


Thats not only not worth the toil, it won't work.

--
Randy
comp.lang.javas cript FAQ - http://jibbering.com/faq

Jul 23 '05 #8
Alberto wrote:
ahhhhhh, a rebuttal....
Well Randy, I do that on my website, though I don't fire an alert by that
but I do another thing; guess what: it works.
I guess it depends on the definition of "works" and what the criteria are.
If you don't know how to do a thing, don't jump on those who hint they do
it.
I didn't. But I definitely know how to come close to accomplishing what
the OP asked for.
When I don't understand something, I at most ask cfor clarification, I
never, never draw a conclusion, especially if it is just to add a stupid
comment to a person who was trying to provide some help to a THIRD person.
Nor do I.
Never rebuttals, Randy. Never. Didn't mom tell you, after so many years on
this group?
I didn't rebut you, I made a statement of fact.
N E V E R rebuttals - they cause problems. And as I said, not only it is
not worth the toil, but if you take the toil, it W_O_R_K_S.
I still beg to differ. If you are appending a querystring and check for
that querystring, you would have to either check the destination (via
onclick), or, check it upon load. Checking it upon load doesn't tell you
anything other than where you came from, not where you are going. That
leaves checking it when you leave the page. The only way to check it
when you leave the page is to have an onclick on each button/link that
sets some flag, then check that flag. That still won't tell you the
scenario I gave.

page2.html has a link to page3.html to page4.html and so on to
page15.html. Now, lets say I bookmark page15.html, and open page2.html.

You have code in page2.html that attempts to detect the destination when
I leave. I open the Favs and click the link to page15.html (or even
better example is to go to a different site all together). Now, since
page2.html has absolutely *no* way of knowing where I am going, would I
get the alert or not? And, should I? Going to page15.html from my Favs,
I shouldn't get the alert, but going to any other non-same-site should
give the alert. Yet, the document has *no* way of determining that.

So again, no, you can *not* tell where I am going when I leave a page
(with the above noted exception), only that I left. And that is at it
should be. I left, leave me alone, let me surf in peace. To give me an
annoying alert when I leave is a sure fire way to make sure a surfer
*never* comes back.

As for my second argument as it not "working". Disable javascript in
your browser, and then please, for the life of me, tell me how you
intend to popup, popunder, alert, confirm, prompt or anything else in
script?
goodnight


Goodnight.

--
Randy
comp.lang.javas cript FAQ - http://jibbering.com/faq
Jul 23 '05 #9
"Targa" <ta************ ***********@all tel.net> wrote in message news:<kG******* ******@fe39.use netserver.com>. ..
Ive seen alert scripts triggered by links but I need one that will cover any
link or pressing the back/forward buttons.

And most people avoid those sites unless they are giving away something for free.

Robert
Jul 23 '05 #10

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

Similar topics

1
2262
by: IVer Erling Årva | last post by:
I have a frameset where one frame contains a menu and the other the screens where the contents change depending on what the user clicks in the menu. Is there any relatively easy way to give the user a warning that changes should be saved and will be lost unless doing so when she or he clicks an option in the menu. This should of course only happen if something is changed. Any help is appreciated!
6
2054
by: Jorntk | last post by:
<script language="JavaScript"> !-- function onLoad() { if( self.innerWidth < 1024 ) { self.moveTo( 0, 0 ); self.resizeTo( screen.availWidth, screen.availHeight ); }
2
1194
by: Kevin Burton | last post by:
I have built a HTTP Module in hopes of being able to trap when a user leaves a site (say from my application to Google). If the user comes back I would like to force them to log in again. So I need to note that they have left and either close out the session variable or somehow cache the fact that they have left. It seems that I can catch everything from Begin to End but I am not sure what to catch when the user leaves the site. Any...
23
14515
by: Bjorn | last post by:
Hi. Every time i post data in a form the contents are being checked for validity. When i click the back-button, all data is gone and i have to retype it. It's obvious that only a few or none of the visitors will retype it all so i'm asking: "how to preserve POST-data when clicking the back-button?" i've already tried to print post data as a value in a HTML tag but
2
2883
by: Chamomile | last post by:
Does anyone know a way to disable the 'refresh alert' windown that pops up in ie when document.location.reload() is used on a page that has post data? In thecontext I'm using reload() this message is definitely not required and tends to worry the user. In fact it makes no difference whether the user chooses 'Retry' or 'Cancel' , but simply being presented with an official looking pop-up and what looks like an important decision
2
1786
by: ozzii | last post by:
Hi, Does any body know how to create an asp email alert system. I wish to send members an email alert at the end of the day for updates to the site that meet their search criteria. for example if a member has set up a particular job search email alert when a job matching that criteria is posted i need to notify them at the end of the day. I know its possible to generate an email alert at the time the job is posted but this will clogg up...
3
1426
by: sake | last post by:
I don't mean disabling leaving the site entirely, forcing the user to remain at my god forsaken mess for the rest of eternity. But instead just disabling going to any other part of my site (until certain requirements are met). Is there any way to do this securely without putting a check for the requirements at the beginning of each page? -Sake
1
1513
by: azgaranoop | last post by:
Hi, i want to display a alert box when a user leave my site.... Means if a user clck on X button i.e on top right corner of the browser or the user click on the address bar and try to change the address then a alert box display.. Simply display a alert box when a user is about to leave my site throught any of these two ways discuss above..... please provide me code for this........ Thanks
0
8979
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
8818
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
9522
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
9354
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...
1
9307
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9223
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
8233
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...
0
4860
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3296
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

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.