homepage Welcome to WebmasterWorld Guest from
register, free tools, login, search, pro membership, help, library, announcements, recent posts, open posts,
Become a Pro Member

Home / Forums Index / Code, Content, and Presentation / JavaScript and AJAX
Forum Library, Charter, Moderator: open

JavaScript and AJAX Forum

How to create a "Are you sure you want to leave this page?" drop down
How to create a drop down to see if you can hold a user just a bit longer

5+ Year Member

Msg#: 3996805 posted 2:52 am on Sep 27, 2009 (gmt 0)

I'm sure this is simple, and I've seen these a million times, but for the first time I have a need to create one of those drop downs that interrupts a person from leaving a page with the simple question: are you sure?

I'm building a squeeze page for a seminar i'm putting together. I figured I would monetize it by presenting them a "special offer" if they decide to leave without signing up to attend.

I honestly have no idea how they're created, i'm assuming it's in java script but all my searches on this site as well as on the web have come up empty. this is what i want to do:

1. user decides to leave my page without registering for an event.
2. a drop down is activate saying "before you leave I'd like to present you with a special offer. click ok and you will be taken to the offer where if you'd like to take a look click ok, if not click cancel"
3. they click ok to continue
4. they're directed to an ebook pdf purchase page that then immediately has a drop down that then gives them the ability to stay and look at the page or click cancel to be returned to wherever they came from.

5. help. i don't have a clue what goes into creating one of these.

sorry if this is posted in the wrong section



WebmasterWorld Senior Member 5+ Year Member

Msg#: 3996805 posted 11:53 am on Sep 27, 2009 (gmt 0)

I would recommend not using such a tactic. From my perspective it is a big turn off.

But alas I am just one. Others may not share my opinion.

The solution would be to use the unload event of the body tag on your page.


WebmasterWorld Senior Member rocknbil us a WebmasterWorld Top Contributor of All Time 5+ Year Member

Msg#: 3996805 posted 5:01 pm on Sep 27, 2009 (gmt 0)

It's not just you . . . Exit polls/alerts/pages are despised by most, and promoted by marketers everywhere, it's an argument that will never go away. They must work to some degree or they wouldn't persist.

Yes you'll have to use Javascript or VBscript to initiate a new window on unload of the parent page as described, one would only have to have a moderate skill in Javascript to pull it off.


5+ Year Member

Msg#: 3996805 posted 7:57 pm on Sep 27, 2009 (gmt 0)

yes, i think it's a give and take. i'm torn because i don't really like them either, but if they're "tastefully" done i can see how they'd be effective.

one would think the javascript should be readily available out there somewhere, right? I'd think there would be a resource where i could find out how to do it?


WebmasterWorld Administrator phranque us a WebmasterWorld Top Contributor of All Time 10+ Year Member Top Contributors Of The Month

Msg#: 3996805 posted 1:56 am on Sep 28, 2009 (gmt 0)

it's in the source code of every page that exhibits this behavior.


WebmasterWorld Senior Member 10+ Year Member

Msg#: 3996805 posted 6:18 pm on Sep 28, 2009 (gmt 0)

I used to go out of my way to cause one of these to appear --- it was in the checkout for a hosting company... if you loaded the "Sign Up Now" page, then attempted to navigate away from it you'd get a dialog offering you a huge discount... the only way to activate the discount code was by clicking the "Return to sign up page now" link.


5+ Year Member

Msg#: 3996805 posted 7:32 pm on Sep 28, 2009 (gmt 0)

so is there some code out there floating around that you can point me to? Something i can throw into place and then modify to my needs?


Msg#: 3996805 posted 9:32 pm on Sep 28, 2009 (gmt 0)

just go surfing for warez or prohibitedpron ,their affs were always the main users of such ..also you may come across chromeless popups that take browser focus ..instant "you need this codec" messages etc ..

just so as you know what company you are seeking to keep ..:)

and why no-one here is ( hopefully ) going to point you at a "copy / paste" script ( BTW almost all scripts of this sort trigger either alerts in browsers or get auto blocked by modern browsers ) ..what is more acceptable ( but irritating nonetheless ) are dhtml "slide ins" that you as a surfer can dismiss ..

there are many commercial apps than can make them seamlessly for you if you cant code your own ..

and as I'm aware of at least one member here who sells such apps ..dont ask me for the "how to" :)


5+ Year Member

Msg#: 3996805 posted 9:40 pm on Sep 28, 2009 (gmt 0)

haha.. ok! fair enough. I'm using aweber for my opt-in list on the registration page. i could use a second exit form, too, maybe?

Global Options:
 top home search open messages active posts  

Home / Forums Index / Code, Content, and Presentation / JavaScript and AJAX
rss feed

All trademarks and copyrights held by respective owners. Member comments are owned by the poster.
Home ¦ Free Tools ¦ Terms of Service ¦ Privacy Policy ¦ Report Problem ¦ About ¦ Library ¦ Newsletter
WebmasterWorld is a Developer Shed Community owned by Jim Boykin.
© Webmaster World 1996-2014 all rights reserved