General Question

mirza's avatar

Can anyone help me with a Javascipt ?

Asked by mirza (5057points) July 13th, 2008

Ok i have no javascript knowledge whatsoever. But my client wants a java script alert window and a way to re-direct the page.

For instance user hits the back button OR clicks the X, or types in a new web address. Alert window shows. if the user clicks “okay/yes” – (yes leave site) – then let them go to whatever site they were trying to go to.if cancel (no stay on site) then redirect to a new html page on our site.

Any idea how I might do this. Or a good article that could help me figure this out by tonight.

Observing members: 0 Composing members: 0

3 Answers

jasonjackson's avatar

See this article on the window.onbeforeunload event:
http://www.4guysfromrolla.com/webtech/100604–1.shtml

bugmenot's avatar

Obviously the person that gave jasonjackson a great answer didn’t look at the link provided. Sorry for being off topic mirza.

jasonjackson's avatar

Fluther does weird things with dashes sometimes. I’m not sure how to stop it. Anyway, replace the long dash that’s there with a regular ol’ dash, and the link will load. And be quite helpful, I might add. ;-)

Answer this question

Login

or

Join

to answer.

This question is in the General Section. Responses must be helpful and on-topic.

Your answer will be saved while you login or join.

Have a question? Ask Fluther!

What do you know more about?
or
Knowledge Networking @ Fluther