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
  • 466
  • 4
  • 14
Jason
  • 7,612
  • 14
  • 77
  • 127

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,285
  • 3
  • 26
  • 36
0
after 

window.close()

you trying to open a new

window.open()
zod
  • 12,092
  • 24
  • 70
  • 106