Atrox / sweetify-django

SweetAlert integration for Django
BSD 3-Clause "New" or "Revised" License
55 stars 21 forks source link

Pop up will show on back click #13

Closed jsa2233 closed 4 years ago

jsa2233 commented 4 years ago

Hi Atrox, I am experience an issue on a similar view as in the below; where the popup keep showing after the redirection especially when I click on a different url page and use the "back" option in the browser the pop up will show again ! any idea how to fix it or would it be a bug I am not sure. Many Thanks a lot Jabor


import sweetify

def test_view(request):
    sweetify.success(request, 'Deleted!')
    return redirect('xyz:index')
Atrox commented 4 years ago

Hey @jsa2233, this sounds like the browser cache. If you press back, the browser doesn't request the page again and instead uses the one in the cache. This causes the sweetify javascript to be executed again.

You could set the Cache-Control: no-cache header if you display a sweetify message which should fix this.

jsa2233 commented 4 years ago

Hey @jsa2233, this sounds like the browser cache. If you press back, the browser doesn't request the page again and instead uses the one in the cache. This causes the sweetify javascript to be executed again.

You could set the Cache-Control: no-cache header if you display a sweetify message which should fix this.

Thanks a lot @Atrox that solved my issue.