Force Firefox to Reload Page on Back Button

后端 未结 8 1642
孤独总比滥情好
孤独总比滥情好 2020-12-14 08:37

How do you make Firefox rerun javascript and reload the entire page when the user presses the back button? I was able to do this in all browsers except Firefox from the hel

相关标签:
8条回答
  • 2020-12-14 09:27

    I think the answer you might want is here: https://stackoverflow.com/a/5493543/1475148

    TLDR: HTTPS + Cache-Control: must-revalidate as a server-sent header + Expires header set in the past should make it work. Here’s a sample PHP implementation:

    <?php
    
    $expires = gmdate( 'D, d M Y H:i:s', time() - 1 );
    
    header( 'Cache-Control: must-revalidate' );
    header( "Expires: {$expires} GMT" );
    
    ?>
    <!DOCTYPE html>
    <html>
        <head>
            <title>Auto-reloading page</title>
        </head>
        <body>
            <p>The current day is <?php echo date( 'd, F Y'); ?> and the time is <?php echo date('H:i:s'); ?>.</p>
            <p><a href="http://google.com">Click away</a></p>
        </body>
    </html>
    
    0 讨论(0)
  • 2020-12-14 09:29

    add this between your HEAD tags

    <META HTTP-EQUIV="Pragma" CONTENT="no-cache">
    <META HTTP-EQUIV="Expires" CONTENT="-1">
    
    0 讨论(0)
提交回复
热议问题