I followed this link to remove all my duplicate messages.

Error/Success messages show wrong page and are not cleared

It worked for desktop chrome. But when test it on actual device like android and iphone It shows duplicate as well as previous all messages.

enter image description here

It works perfectly for desktop chrome/safari.
How to fix this?

  • Which Magento2 version you using? – Amit Naraniwal Mar 13 at 5:53
  • my Magento version is 2.30 – summu Mar 13 at 5:55
  • Have you tried to clear Mobile devices cache? – Amit Naraniwal Mar 13 at 5:58
  • @AmitNaraniwal yes I did, doesn't work, same issue – summu Mar 13 at 6:14

Try this solution :

copy vendor/magento/module-theme/view/frontend/web/js/view/messages.js to your theme file, and at the end of initialize function add:

$(window).on('beforeunload', function(){
    $.cookieStorage.set('mage-messages', '');

Reference : https://github.com/magento/magento2/issues/10107

  • I already added this line before that's why it works fine in desktop, but I don't know why it didn't work on mobile devices(not emulator) – summu Mar 13 at 7:19

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.