How do I prevent safari from caching my site?

<head>
<meta http-equiv="pragma" content="no-cache" />
<meta http-equiv="cache-control" content="no-cache" />
<meta http-equiv="expires" content="-1" />
<meta content="yes" name="apple-mobile-web-app-capable" />
<meta content="text/html; charset=utf-8" http-equiv="Content-Type" />
<meta content="minimum-scale=1.0, width=device-width, maximum-scale=0.6667, user-scalable=no" name="viewport" />
<link href="css/style.css" rel="stylesheet" media="screen" type="text/css" />
<script src="javascript/functions.js" type="text/javascript"></script>
<title>titles</title>
<meta content="keyword1,keyword2,keyword3" name="keywords" />
<meta content="Description of your page" name="description" />
</head>

I have searched everywhere and cant seem to find a solution. I am trying to use an image ramdomizer.

Thanks for your help

Try sending the http-equiv’s - and Last-Modified - as HTTP headers instead of meta http-equiv’s

It may be the browser ignores those or gives the HTTP headers priority over them

Now, those <meta> elements aren’t going to have any effect on an images you display in the page. You’ll need to have your server send HTTP headers preventing caching attached to the response for the image itself.

Seeing as this is for mobile devices, I wonder what would be more of an issue for your visitors. Caching or more bandwidth use?

I really think the main issue here is the image randomizer and “site” was just an unfortunate word choice. If that’s the case, they’ll probably be able to drop the <meta> stuff, allow the browser to cache the HTML, and just send anti-cache headers for the image.

Though, I suppose it would be nice to see how this image randomizer actually works.

I’ve done some basic research and apparently Safari (iOS) ignores the command via server-request to override with no caching if “apple-mobile-web-app-capable” is set to YES (which is relative to HTML5). Perhaps try setting it to NO (that seems to have worked for others) or directly going after the cache manifest. You learn something new everyday I guess (I didn’t know about this quirk). This may also be of interest: http://www.phpied.com/iphone-caching/ :slight_smile: