I'm trying to load an image from the Firefox cache as the title suggests. I'm running Ubuntu, so the location of my cache is /home/me/.mozilla/firefox/xxxxxx.default/Cache
正如标题所示,我正在尝试从Firefox缓存中加载图像。我正在运行Ubuntu,所以我的缓存位置是/home/me/.mozilla/firefox/xxxxxx.default/Cache
However, in the Cache (and this is on Mac, too) the filenames are just ridiculous combinations of letters and numbers. Is there a way to pinpoint a certain file?
但是,在缓存中(这也是在Mac上),文件名只是字母和数字的荒谬组合。有没有办法确定某个文件?
3 个解决方案
#1
You should take a look at the source code of the CacheViewer Add-on.
Download the file instead of installing it (right click and save as) and then extract it (it's just a Zip file, even though it has a .xpi extension), then extract the cacheviewer.jar file inside the resulting chrome folder. Finally go into content and then cacheviewer to find the javascript and XUL files.
您应该查看CacheViewer Add-on的源代码。下载文件而不是安装它(右键单击并另存为),然后解压缩它(它只是一个Zip文件,即使它有.xpi扩展名),然后在生成的chrome文件夹中提取cacheviewer.jar文件。最后进入内容然后cacheviewer找到javascript和XUL文件。
From my brief investigation, the useful routines are in the cacheviewer.js file, though if you were hoping there would be a simple javascript one liner for accessing cached items you're probably going to be disappointed. The XUL files (which are just XML) are helpful in working out which JS functions are called to perform particular tasks. I'm not too sure how all this maps into Greasemonkey, rather than the extension environment, but hopefully there's enough code to get you started.
从我的简短调查来看,有用的例程在cacheviewer.js文件中,但是如果你希望有一个简单的javascript一行来访问缓存的项目你可能会感到失望。 XUL文件(只是XML)有助于确定调用哪些JS函数来执行特定任务。我不太清楚所有这些都映射到Greasemonkey,而不是扩展环境,但希望有足够的代码来帮助你入门。
#2
Ummm, that really is an internal implementation detail. But I suggest looking at how about:cache?device=disk and about:cache-entry?client=HTTP&sb=1&key=https://*.com/Content/img/wmd/blockquote.png are implemented.
嗯,这真的是一个内部实现细节。但我建议看看如何:cache?device = disk和about:cache-entry?client = HTTP&sb = 1&key = https://*.com/Content/img/wmd/blockquote.png已实现。
Also, http://www.securityfocus.com/infocus/1832 gives details, too. Note that Firefox doesn't use a separate file for everything...
此外,http://www.securityfocus.com/infocus/1832也提供了详细信息。请注意,Firefox不会为所有内容使用单独的文件...
And of course, Firefox may change the format at any time.
当然,Firefox可能随时更改格式。
#3
Just give your img src=
attribute the full URL. If the image happens to be cacheable (the server sends an appropriate Expires:
or Cache-control:
header, for example) and it's already in the cache, Firefox will not hit the network.
只需为您的img src =属性提供完整的URL即可。如果图像恰好是可缓存的(例如,服务器发送适当的Expires:或Cache-control:标头)并且它已经在缓存中,则Firefox将不会访问网络。
HTTP caching is supposed to be invisible. When you're generating content, you generally shouldn't worry about it.
HTTP缓存应该是不可见的。当您生成内容时,通常不必担心它。
You can point REDbot at a URL to see all sorts of delicious information about its cacheability.
您可以将REDbot指向URL,以查看有关其可缓存性的各种美味信息。
#1
You should take a look at the source code of the CacheViewer Add-on.
Download the file instead of installing it (right click and save as) and then extract it (it's just a Zip file, even though it has a .xpi extension), then extract the cacheviewer.jar file inside the resulting chrome folder. Finally go into content and then cacheviewer to find the javascript and XUL files.
您应该查看CacheViewer Add-on的源代码。下载文件而不是安装它(右键单击并另存为),然后解压缩它(它只是一个Zip文件,即使它有.xpi扩展名),然后在生成的chrome文件夹中提取cacheviewer.jar文件。最后进入内容然后cacheviewer找到javascript和XUL文件。
From my brief investigation, the useful routines are in the cacheviewer.js file, though if you were hoping there would be a simple javascript one liner for accessing cached items you're probably going to be disappointed. The XUL files (which are just XML) are helpful in working out which JS functions are called to perform particular tasks. I'm not too sure how all this maps into Greasemonkey, rather than the extension environment, but hopefully there's enough code to get you started.
从我的简短调查来看,有用的例程在cacheviewer.js文件中,但是如果你希望有一个简单的javascript一行来访问缓存的项目你可能会感到失望。 XUL文件(只是XML)有助于确定调用哪些JS函数来执行特定任务。我不太清楚所有这些都映射到Greasemonkey,而不是扩展环境,但希望有足够的代码来帮助你入门。
#2
Ummm, that really is an internal implementation detail. But I suggest looking at how about:cache?device=disk and about:cache-entry?client=HTTP&sb=1&key=https://*.com/Content/img/wmd/blockquote.png are implemented.
嗯,这真的是一个内部实现细节。但我建议看看如何:cache?device = disk和about:cache-entry?client = HTTP&sb = 1&key = https://*.com/Content/img/wmd/blockquote.png已实现。
Also, http://www.securityfocus.com/infocus/1832 gives details, too. Note that Firefox doesn't use a separate file for everything...
此外,http://www.securityfocus.com/infocus/1832也提供了详细信息。请注意,Firefox不会为所有内容使用单独的文件...
And of course, Firefox may change the format at any time.
当然,Firefox可能随时更改格式。
#3
Just give your img src=
attribute the full URL. If the image happens to be cacheable (the server sends an appropriate Expires:
or Cache-control:
header, for example) and it's already in the cache, Firefox will not hit the network.
只需为您的img src =属性提供完整的URL即可。如果图像恰好是可缓存的(例如,服务器发送适当的Expires:或Cache-control:标头)并且它已经在缓存中,则Firefox将不会访问网络。
HTTP caching is supposed to be invisible. When you're generating content, you generally shouldn't worry about it.
HTTP缓存应该是不可见的。当您生成内容时,通常不必担心它。
You can point REDbot at a URL to see all sorts of delicious information about its cacheability.
您可以将REDbot指向URL,以查看有关其可缓存性的各种美味信息。