The best solution is to warn the user with appropriate message Try this
window.onbeforeunload = function() { return "Your work will be lost."; };
hello
i am making an eCommerce application in laravel and adding products to the cart using session. whenever a product is added to the cart, it will redirect to the basket page where all cart products are shown. but i just noticed that when I add the item to the cart and after that if I click the back arrow of the browser, the item is removed from the session. everything is working fine except this. i don't get why this is happening. perhaps somebody knows about this?
Please or to participate in this conversation.