Click to See Complete Forum and Search --> : Javascript question. Can it determine when url is exited?


joelmon
01-03-2002, 07:21 PM
Hello, I was wondering if anybody knows
how javascript (if possible)
can tell when you leave a url www.domain.com (http://www.domain.com)
and then put up an alert box

I have a script that uses onunload within a frame, but what sucks is it works during refresh, not just leaving the frame (If you leave the domain, the frame is done with, so the alert box comes out)

My goal is to have a sort of onleave
if you will where when the *Domain* is exited, not just the page, the alert is activated

Is this possible?

Thanks

EyesWideOpen
01-04-2002, 02:05 PM
Maybe you could check the window.location (or something similar if that doesn't return what's actually typed in the location box) everytime the page is [un]loaded and then pop up an alert box only when the domain is changed. I'm not sure that you can do regex matching in JavaScript though...

joelmon
01-04-2002, 10:07 PM
That's my dilema. Thanks for the reply by the way

I don't know how to tell if the url is changed in javascript