...

View Full Version : How to create an error message when one closes the window



kirannayak
05-04-2011, 07:56 AM
I would like to know how to create an error message when someone decides to close my blog!
For example i am on your blog and you don't want me to go from your blog. So. inorder to make the person to think twice you will create an error message when someone closes your window with the message that you will be providing an better offer!!

Iam a complete beginner in this!!

Any Help will be appreciated!!

Thanks in advance!!

AndrewGSW
05-04-2011, 11:36 AM
I'd rather you didn't - just make your blog more interesting! (If I received this error message I would never come back!)


<body onbeforeunload="alert('Goodbye forever!');" >

hotelscyprus
05-04-2011, 02:03 PM
Andrew..."onbeforeunload" will work good on all browsers ? Long back I had some problem with Firefox and fixed by a friend.

teedoff
05-04-2011, 02:13 PM
uggghhh. Nothing I hate worse than trying to leave a site and a message pops up asking me am I sure I want to leave. Well if I clicked the "X" then YES I'm wanting to leave!

As Kor said, dont make your visiters annoyed and risk them never coming back just to add some fancy javascript like this. I dont usually go back to sites like this either.

AndrewGSW
05-04-2011, 02:40 PM
If you still insist on doing this :mad: then it works.. as well as can be expected! But not properly in Opera.



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum