Precached images using JavaScript

Images often take several extra time to download from a Web server. If images change in response to user actions then we may want the same fast response that users are accustomed to. It may be an irritating while users are waiting for image(s) to be downloaded for a page. JavaScript comes to the rescue by enabling scripts to load images into the browser’s memory cache without displaying the image, a technique called precaching images. In this technique images load into browser’s image cache when the page initially loads. A precached image differs in some respects from the document object that we create using <img/> tag. Objects created in memory are not seen on the page at all but their presence in the document code forces the browser to load images when the page gets loaded. The Image object constructor function is used to create the memory type of image object as follows: Continue reading “Precached images using JavaScript”

How to disable browser cache easily in Codeigniter

This tutorial shows how to prevent browser caching easily in Codeigniter.

We face some kind of problems in real life when browser caches the data particularly when there are session data. Though we destroy session but still using back button users are able to view some data on browser. For example, when user logged in to the application they can easily go back to the login page using the browser’s back button. Again when user logged out of the application they can easily navigate to the previous page using browser’s back button.

So we can prevent browser caching data using some mechanism. So our below example will show how to achieve it easily in Codeigniter. Continue reading “How to disable browser cache easily in Codeigniter”