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
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
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