Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Redirect on page close

Status
Not open for further replies.

audiopro

Programmer
Apr 1, 2004
3,165
0
0
GB
This seems a popular topic but I have been unable to find a definitive answer.
I have an e-commerce website where a large number of people navigate away from the address gathering part of the sales process. The process is simple enough but I am wondering if visitors find something confusing.
I have been helped with the following code which almost does what I want, but not quite

Code:
<html>
<head>
<script type="text/javascript">
  var needToConfirm = true;
  window.onbeforeunload = confirmExit;
  function confirmExit()
  {

var posX = window.document.body.offsetWidth - window.event.clientX ;
var posY = window.event.clientY;
if (posX <=30 && posY < 0 ) {

//=======================================
// Want to open a window in _self here
//=======================================

	return "window was closed"
}
  }

</script>
</head>

<body>

<form action = '[URL unfurl="true"]http://www.studiosoft.co.uk/javasc/save.htm'>[/URL]
<input type="Submit" value="Save" onclick="needToConfirm = false;" />
</form>

</body>
</html>

The code detects the pressing of the close button and ignores all other close commands but is it possible to load another page into _self within the function. I did experiment with window.open() but it just activates the popup blocker.

Any help would be appreciated.

Keith
 
Hang I've just had a Deja Vu moment :-D
Why not use alert(), confirm() or input() which are all modal dialogue boxes, to ask the user if they really want to exit?






Chris.

Indifference will be the downfall of mankind, but who cares?
Time flies like an arrow, however, fruit flies like a banana.
Webmaster Forum
 
This is an order process, the visitor has to select a product and fill in a captcha field before going to the next stage. Their basket is shown with order price and postage.
I would understand if people exited here on account of the price.
They click 'Go To Check out' and then they are directed to the address screen. It is at this point that quite a number of visitors are closing the page down.

I would like to open a simple form asking them why they are leaving and giving them the chance to register for special offers etc.

I can display the grey message / alert box no problem but I want to launch a new page as it would be more intuative.

I don't really just want a grey box to appear in the middle of the screen.


Keith
 
You have a Captcha for people willing to pay you?????


Do you not want their money?

Chris.

Indifference will be the downfall of mankind, but who cares?
Time flies like an arrow, however, fruit flies like a banana.
Webmaster Forum
 
Not a fan of Captcha then?
Never had a problem with the one I designed. Many of the ones I see on other sites are unreadable, kind of makes them a waste of time.

What is a workable alternative to them and is there a way to achieve my original goal?

Keith
 
Not a matter of a fan or not, but if someone put a CAPTCHA in my path to checkout after having decided to buy something I would simply close my browser and never consider buying from there again.

NEVER, EVER put ANYTHING in the way of the payment process that means the payment imperative or the flow of operation is lost, it is FATAL.
I'd suggest reading Steve Krug's book Don't make me think for common sense web usability.

If you need some extra information try and collect it AFTER they have paid.
Billing address and/or delivery address can be obtained from the payment processor in the returned information, from where it should have been checked and verified by people with more resources than you have available AND should it subsequently prove to be a fraudulent transaction you have the protection of the processor for allowing it.

Chris.

Indifference will be the downfall of mankind, but who cares?
Time flies like an arrow, however, fruit flies like a banana.
Webmaster Forum
 
Collecting the address before going to Paypal dates back to a time when Paypal was a bit hit and miss. I collect the address and then if the sale doesn't go through, the customer can still be contacted. Relying on a return message from Paypal to gather the address, could result in a lost order.

Including the Captcha, which is a numeric only one was to prevent the bots from sending the form. I have never given filling Captchas in, much thought except for one on a certain UK newspaper's readers comments section which is usually unreadable.

Keith
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top