It's me ;-)

Page expried problem

Hôm nay tôi dính phải 1 bug khá củ chuối: sau khi submit form, back button không hoạt động trên IE6 browser. Khi click vào nút back này sẽ xuất hiện 1 thông báo như sau:

Warning: page has expired The page you requested was created using information you submitted in a form. This page is no longer available. As a security precaution, Internet Explorer does not automatically resubmit your information for you.

To resubmit your information and view this Web page, click the Refresh button.

Sau một hồi tham khảo các cách giải quyết trên mạng thì sinh ra được cái hàm này:

/**
* Fix back button on IE6 (stupid) browser
* @author khanhdn
*/
function fixBackButtonOnIE() {
//drupal_set_header("Expires: Sat, 27 Oct 1984 08:52:00 GMT GMT");    // Always expired (1)
//drupal_set_header("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT");    // always modified (2)
drupal_set_header("Cache-Control: no-store, no-cache, must-revalidate");    // HTTP/1.1 (3)
drupal_set_header("Cache-Control: public");    (4)
drupal_set_header("Pragma: no-cache");    // HTTP/1.0   (5)

ini_set('session.cache_limiter', 'private');    (6)
}

Tạm comment cái (1) (2), vẫn chạy okie. Có lẽ chỉ cần giữ lại (3) (4) (5) là đủ???

Dù sao cũng giải quyết được cái bug này >”<

Leave a Reply

Your email address will not be published. Required fields are marked *