0

in an effort to reduce shopping cart abandonment, I would like to do a pop window offering a 5% coupon code when a user goes to close the shopping cart page.

I've seen these, and yes they can be annoying, but I can't seem to locate code for doing this.

joe.dawley
  • 456
  • 4
  • 14
Jason
  • 7,457
  • 13
  • 75
  • 120

2 Answers2

1

There is a window event called onbeforeunload. You can return a string in that event and it will echo that string to the user and prevent the window from closing. So you can do something like:

window.onbeforeunload = function( ) {
    return 'Are you sure you want to close this window?';
}
Benjam
  • 5,135
  • 3
  • 27
  • 35
0
after 

window.close()

you trying to open a new

window.open()
zod
  • 11,702
  • 23
  • 66
  • 104