ballhogjoni Posted February 1, 2008 Share Posted February 1, 2008 The code below is supposed to run when the user tries to leave the page. It works if the user clicks their home page button, but if they try to exit the page or refresh the page it doesn't work. <script language="javascript"> var occured="no"; function ucantgoyet() { if (occured == "no") { if (confirm("WAIT! We hate to see you go without trying the eBay Auction Success Toolkit. So, just this once we'd like to offer you our top selling money making eBay Success Kit for $1.00 if you'll change your mind right now.\n\nThat's over $894 in value for the small investment of just $1.00.\n\nIt's a great value! Click OK to get started")) { document.location.href = "https://realfinancialsuccess.com/secure/ebaysuccesskit/index3.php"; } else { if (confirm("Are you sure you don't want to begin your eBay business and remove yourself from the same old 9-5 routine? You are getting a tremendous oppurtunity and deal. \n\nIts just $1.00 and you can begin your money making quest on eBay.\n\nRemember you get a 200% MONEY BACK Guarantee, if you don't receive the results you want, we will pay $3.90 (double your money).\n\nYou will kick yourself if you miss the oppurtunity! Click OK to get started")) { document.location.href = "https://realfinancialsuccess.com/secure/ebaysuccesskit/index3.php"; } else { } } } } </script> Quote Link to comment Share on other sites More sharing options...
phpQuestioner Posted February 1, 2008 Share Posted February 1, 2008 The original code I gave you does work; you have changed the code around and now it doesn't work. Revisit the original code I posted for you: http://www.phpfreaks.com/forums/index.php/topic,179668.msg800958.html Quote Link to comment Share on other sites More sharing options...
ballhogjoni Posted February 2, 2008 Author Share Posted February 2, 2008 No this is a completly different question. The code works just fine until the user wants to close the page or refresh the page. Basically, if the user clicks the close button on their browser, the script will run, but when they click ok the browser closes. It should redirect them to the url listed. Same thing when you refresh the page. Quote Link to comment Share on other sites More sharing options...
phpQuestioner Posted February 4, 2008 Share Posted February 4, 2008 You really cannot prevent the: tab, window, or browser from closing. You might find a way to stall it; but the end result would be; if someone really wanted to close your page; they could. Quote Link to comment Share on other sites More sharing options...
ballhogjoni Posted February 5, 2008 Author Share Posted February 5, 2008 Thx for your help. I just went ahead and had the script open() a new window when they click ok. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.