gpt4 book ai didi

javascript - ExpiresByType text/x-javascript 和 google 分析

转载 作者:行者123 更新时间:2023-11-28 01:14:08 25 4
gpt4 key购买 nike

在我的网站上直接在 body 标记后面使用最新的 javaScript 代码实现 Google Analytics 之前,我的 .htaccess 中曾经并且仍然有以下代码:

ExpiresByType text/x-javascript "access plus 1 month"

这是否意味着在我实现分析代码之前访问过该网站的每个用户都会由于 JavaScript 被缓存而跳过该网站?

最佳答案

简短回答

只要您在 header 或新的外部 .js 文件中提供它,它们就不会跳过它。

长答案

来自 feedthebot.com 的 Patrick Sexton 完美地解释了这一点 here:

Common caching issue

If you list your html and images to be cached for one year or someother long time period, remember that this can mean if you make achange to your pages they may not be seen by all users. This isbecause the users will look to cached files rather than the live ones.If you have file that you tweak occasionally (example - a CSS file)you can overcome the cache issue by using URL fingerprinting.

URL fingerprinting

Getting a fresh (not cached) file resource is possible by having aunique name. An example would be if our css file was named "main.css"we could name it "main_1.css" instead. The next time we change it wecan call it "main_2.css". This is useful for files that changeoccasionally.

关于javascript - ExpiresByType text/x-javascript 和 google 分析,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/24042337/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com