I have a project in which there are several static .html pages.
My problem is that i am showing google map on the page by giving the reference of google API because of that it take lot's of time to load the page. What i want is that after loading first time from the server,if the user hits the same page again then it should retrieve the same page from the cache since the content of the page doesn't change at all.

So kindly provide me the syntax along with an example in .html page.

so how to cache a html page ???

Recommended Answers

All 3 Replies

loading the googlemaps url, means the page is NEVER cached, that url executes every time the page loads, the whole page will never be pulled from the cache, but the elements of the page each image chunk that creates the map, will be

you can give an apparent speed increase by using onload
1;to fire the googlemap api in javascript if you code the mapwrap the entire thing in a function, and call the function onload,OR
2;you can use onload to change the source of the map element

either way the page works, before the map is fully rendered

you can set expiry times in .htaccess

<IfModule mod_expires.c>
ExpiresActive On
ExpiresByType text/html "access plus 1800 seconds" 
ExpiresByType image/gif "access plus 360 days"
ExpiresByType image/jpg "access plus 360 days"
ExpiresByType image/png "access plus 360 days" 
ExpiresByType application/x-javascript "access plus 360 days"
ExpiresByType text/css "access plus 360 days"
ExpiresByType text/javascript "access plus 360 days"
ExpiresByType image/x-icon "access plus 360 days"


The Meta HTTP-EQUIV CACHE-CONTROL is specifically used by Internet Explorer.

The allowed values are:

* Public - may be cached in public shared caches
* Private - may only be cached in private cache
* no-Cache - may not be cached
* no-Store - may be cached but not archived

How to use meta http-equiv="Cache-control" in your HTML

<meta http-equiv="Cache-control" content="description">
Example of the meta tag http-equiv="cache-control"

Add the following meta tag in the source of your web-page. The difference in spelling at the end of the tag is either you use " /> = xml or "> = html.

<meta http-equiv="Cache-control" content="public"><meta http-equiv="Cache-control" content="private"><meta http-equiv="Cache-control" content="no-cache"><meta http-equiv="Cache-control" content="no-store">

source page: affordable custom website design

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.