dongliechuich10319 2015-01-18 16:07
浏览 80
已采纳

缓存中的图像未被使用

I'm working on this web app for which I'd like to cache some static content to lower loading times on a slow connection. Other parts are being generated through PHP and AJAX and can therefor not be cached.

I'm successfully using the cache.manifest to cache the static content, such as images, but I notice that the dynamic pages aren't using them. Instead they are downloading the images again, even though they have been cached, making the caching useless.

Because my dynamic content is generated based on GET-requests the dynamic pages are in the NETWORK section of the manifest (e.g. "user?*"). Might that have something to do with it? Is there a way to maybe force using cached images?

Note: the exact full reference to the dynamic pages (e.g. "user?id=22") is of course not in the manifest. Does that make the cache unreachable for those pages?

  • 写回答

1条回答 默认 最新

  • doushi6932 2015-01-19 10:08
    关注

    Seems I've come up with my own solution.

    Since caching dynamic pages (e.g. "user.php?id=22") broke my application I tried inserting an iframe containing a reference to the manifest instead of referencing it on the page itself. That did not seem to do it for me.

    I now include an explicit reference with a wildcard to the dynamic pages in the CACHE section of the manifest. That does seem to work. They are now not getting cached entirely with parameters et al. (so the application remains functional) but are using the cached images. Might not be ideal but seems to be a pretty simple solution.

    I have not yet tried removing those iframes but my guess is that they can be removed.

    CACHE MANIFEST
    ./user.php
    ./user.php?*
    etc...
    NETWORK:
    ./db_connect.php
    etc...
    
    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥20 java-OJ-健康体检
  • ¥15 rs485的上拉下拉,不会对a-b<-200mv有影响吗,就是接受时,对判断逻辑0有影响吗
  • ¥15 使用phpstudy在云服务器上搭建个人网站
  • ¥15 应该如何判断含间隙的曲柄摇杆机构,轴与轴承是否发生了碰撞?
  • ¥15 vue3+express部署到nginx
  • ¥20 搭建pt1000三线制高精度测温电路
  • ¥15 使用Jdk8自带的算法,和Jdk11自带的加密结果会一样吗,不一样的话有什么解决方案,Jdk不能升级的情况
  • ¥15 画两个图 python或R
  • ¥15 在线请求openmv与pixhawk 实现实时目标跟踪的具体通讯方法
  • ¥15 八路抢答器设计出现故障