Reputation: 139
I want to show a session message after login. i do it using this
@if ($message = Session::get('success'))
<script>
toastr.success('{{ $message }}');
</script>
@endif
but when navigate another web page and click again browser back button . it shows previous session message . How can i remove session messages on browser back button.
I tried
{{ Session::forget('success') }}
it always forget session message. Even not display first time session.
Upvotes: 0
Views: 567
Reputation: 4808
Its because of cache.
you can use headers before sending response
header("Cache-Control: no-store, no-cache, must-revalidate, max-age=0");
header("Cache-Control: post-check=0, pre-check=0", false);
header("Pragma: no-cache");
There is a answer that can help you prevent-browsers-back-button-login-after-logout-in-laravel
Upvotes: 1