Dushee
Dushee

Reputation: 255

ERR_CACHE_MISS error in codeigniter when click backbutton

I have created a small web application using codeigniter.But sometimes when I click back button this error message display. What Should Ido to avoid this matter? Confirm Form Resubmission

This webpage requires data that you entered earlier in order to be properly displayed. You can send this data again, but by doing so you will repeat any action this page previously performed. Press the reload button to resubmit the data needed to load the page. ERR_CACHE_MISS This is part of my main controller

<?php

ob_start();
defined('BASEPATH') OR exit('No direct script access allowed');

    class Home extends CI_Controller {
        public function __construct()
         {
              parent::__construct();
              $this->load->library('session');
              $this->load->helper('form');
              $this->load->helper('url','html');
              $this->load->helper('html');
              $this->load->database();
              $this->load->library('form_validation');


              $this->load->model('Login_model');
              $this->load->model('Select');
              $this->load->model('ProjectEmployees');
              $this->load->model('Employee_model');
              $this->load->model('Welcome_model','welcome');
              $this->load->model('Welcome_model4','welcome4'); 
              $this->load->model('Welcome_modelPI','welcomePI');




         }
         function index()
      { 


        $this->load->view('login_view');


      }

      function logout()
      {
        // destroy session
            $data = array('login' => '', 'uname' => '', 'uid' => '');
            $this->session->unset_userdata($data);
            $this->session->sess_destroy();
        redirect('Home/index');
      }


    public function MyHome()
    {   
        $this->load->view('template/navigation');
            $this->load->view('template/sideNav');
            $this->load->view('template/header');
        $this->load->view('profile_view2');
         $this->load->view('template/footer');
    }

Upvotes: 1

Views: 7610

Answers (1)

Nono
Nono

Reputation: 7302

It's because you Expiring the Page & not sending the Cache Header to Browser. That's why Browser not Caching those pages and while you hitting back Browser displaying ERR_CACHE_MISS instead of your html view..

ERR_CACHE_MISS (Screen):

enter image description here

  1. Make sure you are not Sending Expire Cache Header

  2. Make sure your page not prevent by Browser Cache

  3. Check your Response Header in Browser Net Panel, to See what Header being passed by Server

  4. Check if your are using $this->output->set_header() in your code/controller/hook.

Here are some CodeIgniter Cache Expire Header Code Example..

$this->output->set_header('Last-Modified: ' . gmdate("D, d M Y H:i:s") . ' GMT');
$this->output->set_header('Cache-Control: no-store, no-cache, must-revalidate, post-check=0, pre-check=0');
$this->output->set_header('Pragma: no-cache');
$this->output->set_header("Expires: Mon, 26 Jul 1997 05:00:00 GMT"); 

Upvotes: 1

Related Questions