te')); return $arr; } /* 遍历用户所有主题 * @param $uid 用户ID * @param int $page 页数 * @param int $pagesize 每页记录条数 * @param bool $desc 排序方式 TRUE降序 FALSE升序 * @param string $key 返回的数组用那一列的值作为 key * @param array $col 查询哪些列 */ function thread_tid_find_by_uid($uid, $page = 1, $pagesize = 1000, $desc = TRUE, $key = 'tid', $col = array()) { if (empty($uid)) return array(); $orderby = TRUE == $desc ? -1 : 1; $arr = thread_tid__find($cond = array('uid' => $uid), array('tid' => $orderby), $page, $pagesize, $key, $col); return $arr; } // 遍历栏目下tid 支持数组 $fid = array(1,2,3) function thread_tid_find_by_fid($fid, $page = 1, $pagesize = 1000, $desc = TRUE) { if (empty($fid)) return array(); $orderby = TRUE == $desc ? -1 : 1; $arr = thread_tid__find($cond = array('fid' => $fid), array('tid' => $orderby), $page, $pagesize, 'tid', array('tid', 'verify_date')); return $arr; } function thread_tid_delete($tid) { if (empty($tid)) return FALSE; $r = thread_tid__delete(array('tid' => $tid)); return $r; } function thread_tid_count() { $n = thread_tid__count(); return $n; } // 统计用户主题数 大数量下严谨使用非主键统计 function thread_uid_count($uid) { $n = thread_tid__count(array('uid' => $uid)); return $n; } // 统计栏目主题数 大数量下严谨使用非主键统计 function thread_fid_count($fid) { $n = thread_tid__count(array('fid' => $fid)); return $n; } ?>javascript - Why is Chrome pulling old JS file? - Stack Overflow
最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

javascript - Why is Chrome pulling old JS file? - Stack Overflow

programmeradmin3浏览0评论

I've been having a crazy annoying problem for a few weeks that I can't seem to solve. Occasionally when I update the Javascript or CSS files for my site hosted on Siteground, Chrome will refuse to recognize them. Other browsers will pull the new files immediately if I empty the cache and refresh, Chrome will not.

I have:

  1. Verified through cPanel file manager that the correct files are uploaded to my server.
  2. Repeatedly emptied Chrome's cache.
  3. Repeatedly used devtools "hard reload" and "empty cache and hard reload".
  4. Repeatedly quit and reopened Chrome.
  5. Completely turned off Chrome's cache through devtools.

Maddeningly enough, the problem seems to solve itself when I e back to it a few hours later. What am I missing here that is keeping Chrome from reading the new files?

I've been having a crazy annoying problem for a few weeks that I can't seem to solve. Occasionally when I update the Javascript or CSS files for my site hosted on Siteground, Chrome will refuse to recognize them. Other browsers will pull the new files immediately if I empty the cache and refresh, Chrome will not.

I have:

  1. Verified through cPanel file manager that the correct files are uploaded to my server.
  2. Repeatedly emptied Chrome's cache.
  3. Repeatedly used devtools "hard reload" and "empty cache and hard reload".
  4. Repeatedly quit and reopened Chrome.
  5. Completely turned off Chrome's cache through devtools.

Maddeningly enough, the problem seems to solve itself when I e back to it a few hours later. What am I missing here that is keeping Chrome from reading the new files?

Share Improve this question edited Feb 12, 2017 at 22:07 Dylan Stark asked Feb 12, 2017 at 21:58 Dylan StarkDylan Stark 2,39519 silver badges24 bronze badges 5
  • 2 Check with incognito mode if the problem still occurs. – kind user Commented Feb 12, 2017 at 22:00
  • 1 @Kinduser just checked, still using the old files. – Dylan Stark Commented Feb 12, 2017 at 22:03
  • 2 That's definitely a caching issue. Have you tried disabling Chrome's cache through the Network tab in DevTools? – Obsidian Age Commented Feb 12, 2017 at 22:03
  • 1 @ObsidianAge just tried that as well, still pulling old files. I have pletely emptied the Chrome cache many, many times now yet it still won't update the files. – Dylan Stark Commented Feb 12, 2017 at 22:06
  • If you have access to PHP, you can append the current timestamp to the version of the file, causing it to override the cache each time it is loaded -- href="style.css?v=<?php echo time(); ?>" – Obsidian Age Commented Feb 12, 2017 at 22:13
Add a ment  | 

3 Answers 3

Reset to default 9

Had this problem as well, going into developer tools solved the problem.

  1. open developer tools
  2. click on the network tab
  3. check the disable cache option, then uncheck it.

after doing this it then used the current version of my javascript file.

Sometimes the server itself is caching the responses for certain user agents (which distinguish what kind of browser you're using to the server), which may explain your issue.

I suggest trying to change your UA (user agent) through devtools to what you currently have in firefox/safari for example to see if the problem persists.

That's just one of the ways that the server may cache responses for certain browsers, as it may also change from other small implementation differences.

Check through your server's settings to see if something is being server-cached, or if the server is adding additional caching information through localStorage and similar, and then try to change those settings or the pieces of code that rely on client storages that aren't considered cache.

It wasn't the server (view-source showed current file) and no mand or browser option I've found anywhere worked (including prior answers here).

What finally worked: create a new browser tab and debug from there.

发布评论

评论列表(0)

  1. 暂无评论