[wp-trac] [WordPress Trac] #58293: Browser Back button talking 2-3 second time to redirect to the page

WordPress Trac noreply at wordpress.org
Thu May 11 02:45:53 UTC 2023


#58293: Browser Back button talking 2-3 second time to redirect to the page
--------------------------+-----------------------------
 Reporter:  Hybreeder     |      Owner:  (none)
     Type:  defect (bug)  |     Status:  new
 Priority:  normal        |  Milestone:  Awaiting Review
Component:  General       |    Version:
 Severity:  normal        |   Keywords:
  Focuses:                |
--------------------------+-----------------------------
 I have a WordPress website.

 The security team tested my website as well as the admin panel of
 WordPress.

 They have found one issue, that I am sharing here.. Below is the steps
 that they have followed

 1. Login in the WordPress admin panel

 2. Logout from the WordPress admin panel

 3. Now they have clicked on the back button of the browser and it’s
 showing the dashboard of the wp-admin.

 If they click on any of the links then it will redirect to 404 because the
 session and cookies expired after logout.. which is correct according to
 me

 Now security team says, Once the user clicks on the back button of the
 browser then it should be redirected to 404 or the login page. I have
 tried the below code, If press the back button after logout then it will
 wait for 2-3 sec and redirect to the 404 page.


 {{{
 <script type="text/javascript">        window.onunload = function(){};
 if (window.performance && window.performance.navigation.type ===
 window.performance.navigation.TYPE_BACK_FORWARD) {
 location.reload();        }        window.onpageshow = function(event) {
 if (event.persisted) {            window.location.reload()         }    };
 </script>
 }}}


 The above code is tested and working but the security team says, it’s
 taking 2-3 sec time to redirect, and this is the issue

-- 
Ticket URL: <https://core.trac.wordpress.org/ticket/58293>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list