Dear All Please help Help I have page for checkout ( shopping cart) When person leaves a page I have a javascript called which gives alert Are you sure you want to leave this page? OK and Cancel button Which works fine However I donot want this alert when shopping cart is empty or I want this alert only when the page is left with entries in shopping cart
You will need to have a javascript variable which holds current cart status. Make it either 1 / 0 flag OR total number of items in cart OR whichever way you feel good. When user tries to leave off, check the variable status first and then decide whether exit popup to be displayed or not.
like to clarify more here When cart is not empty, I will make javascript variable say var cartempty=1 I have javascript onunload="onul()" which is called when page leave In this function i need to check for cartempty variable value if cartempty =1 (display message) else no Message