SitePoint Sponsor

User Tag List

Results 1 to 6 of 6
  1. #1
    SitePoint Enthusiast
    Join Date
    Jan 2002
    Location
    Central Florida
    Posts
    29
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    How do I prevent safari from caching my site?

    Code HTML4Strict:
    <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

  2. #2
    Programming Team silver trophybronze trophy
    Mittineague's Avatar
    Join Date
    Jul 2005
    Location
    West Springfield, Massachusetts
    Posts
    17,263
    Mentioned
    196 Post(s)
    Tagged
    2 Thread(s)
    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

  3. #3
    Floridiot joebert's Avatar
    Join Date
    Mar 2004
    Location
    Kenneth City, FL
    Posts
    823
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    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.

  4. #4
    Programming Team silver trophybronze trophy
    Mittineague's Avatar
    Join Date
    Jul 2005
    Location
    West Springfield, Massachusetts
    Posts
    17,263
    Mentioned
    196 Post(s)
    Tagged
    2 Thread(s)
    Seeing as this is for mobile devices, I wonder what would be more of an issue for your visitors. Caching or more bandwidth use?

  5. #5
    Floridiot joebert's Avatar
    Join Date
    Mar 2004
    Location
    Kenneth City, FL
    Posts
    823
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    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.

  6. #6
    Follow: @AlexDawsonUK silver trophybronze trophy AlexDawson's Avatar
    Join Date
    Feb 2009
    Location
    England, UK
    Posts
    8,111
    Mentioned
    0 Post(s)
    Tagged
    1 Thread(s)
    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/


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •