Chrome loading stylesheet from disk cache, never memory cache - google-chrome

I'm trying to figure out why a stylesheet from a website I'm developing always loads via Chrome's disk cache instead of Chrome's memory cache. Expires dates are set for the file. All other resources are loaded from the memory cache.

Load files manually into a ramdisk:
Windows: ImDisk Toolkit (Tip: check the "dynamic allocation" to save on ram space, prefer to use ExFat instead of NTFS if you'd like to save on a few megabytes upon creation)
I use the node package npm install http-server -g to host it locally, since chrome does not allow to load it from file:/// for security reasons.
Load it as usual: <link rel="stylesheet" href="http://127.0.0.1:8080/tailwind.min.css">
Be aware that http-server default settings will host the files to the local network alongside just http://127.0.0.1:8080.
It might be redundant after the first load, but worth trying
http-server also seems to cache regular disk accesses, as by their doc.
On my chrome 96.0.4664.110 (Official Build) (64-bit) after I refresh the page it appears (Memory Cache) for the CSS files I've tried, at the network tab in the element inspector, after I reload the page maybe once, I can't remember.

Related

Chrome is using a cached page when local-serving for web-development

I'm using a node.js local server to serve Chrome a three.js page, and Chrome instead of updating the page when I reload it after I've done some changes, it reloads a cached version instead, and will only update it after I clear all history, then close and re-open the dumb Chrome, which is extremely frustrating and inefficient. That doesn't happen with Firefox. Any ideas?
node.js server run on a .bat file inside the working folder:
http-server -p 8000
exit
on address bar:
http://localhost:8000/mypage.html

Chrome loading cached files on localhost

I'm having this problem across 2 different machines now.
Version 63.0.3239.84 (Official Build) (64-bit)
OSX 10.12.6
Chrome is persistently loading old cached files on http://localhost:3000. The only way I can stop it, is to use incognito. If I use cmd + shift + r it works for a single refresh, then goes back to the old files on reload.
I typically have the inspector up so I've tried ticked disable cache, that doesn't nothing. I've also tried deleting my cached files through chrome's settings, that does nothing.
Anything I'm missing here?
Finally realised what it was. A previous server I was running on that port had a manifest file and the appropriate service workers. It means that chrome was loading those cached files by default.
To fix it I went into developer tools > application > clear storage.
It now works as expected.
Are you sure is it a chrome cache? I mean, check if its really chrome cache getting the full of data in another way like curl, for example:
curl http://localhost:3000
If the content still not reloaded is not chrome problem but another think like your webserver.
If you are running Nginx don't worry it is Nginx configuration called sendfile and you can change it easily just doing this follow steps:
Step 1 - Open nginx configuration with your text editor(vim in my case)
vim /etc/nginx/nginx.conf
Step 2 - Search the line with this text:
sendfile on;
Step 3 - Change to off
sendfile off;
Step 4 - Restart your nginx:
/etc/init.d/nginx restart
Note: If you are using virtual environment like Vagrant reload it
vagrant reload
In my case, Chrome was generating local overrides, for some reason. Before discovering this, I switched ports several times to get past the issue. Chrome had created a local override for my index.html file for each port. After deleting the local overrides, the actual from the server started coming through just fine.

How to create a hyperlink to shared network directory or file?

I've checked the following two related discussions:
1. How do I make a hyperlink to a local executable?
2. An URL to a Windows shared folder
3. File Url Cross Domain Issue in Chrome- Unexpected
4. Firefox Links to local or network pages do not work
The following links work when I visited the website on localhost. That is, http://localhost.
A Shared Network Directory
A Shared Network Directory
A Shared Network Directory
But when I visited with http://172.21.1.123, all of above links have no response.
The debug console shows that Not allowed to load local resource: file://172.21.1.123/DIR.
Test Environment (Both of them have the same result.):
- Chrome 28.0.1500
- IE 10
If it is due to the security reason, any configuration to turn off? Or any idea?
The reason that you cannot link to a network share from an external/hosted/live site is because of security features of latest browsers like Firefox.
You can only open local network shares from a local HTML document.
The only way around this is to install a plugin for your browser that removes or disables this security feature as far as I know.

WebGL Inspector Extension Does Not Appear in Chrome for file:// urls?

My steps (these are the ones described in the docs), under Win 7:
Downloaded/unpacked the zip file
using cygwin, ran the buildextensions.sh file, which created the lib and extensions dirs
opened Chrome
installed the webgl extension via the chrome store
(various repeats of closing/relaunched chrome along the way from here on, with little help)
chrome setup->extnesions, make sure webgl is enabled
turn on developer mode, "load unpacked extension...." selecting the (created) extensions/chrome directory (in this case, C:\Users\kbjorke\Documents\benvanik-WebGL-Inspector-6108bee\benvanik-WebGL-Inspector-6108bee\core\extensions ) and allow "file://" url's
??? no amount of relaod/update/restart seems to cause the GL logo to appear among the extensions buttons at upper right -- even when I load webgl-intensive pages, UNLESS I first load a webgl page from some NON-file:// page -- if I open another tab with an http:// webgl page, I see the red "GL" indicator TWICE in that address bar, but they both lead to the http:// page, not my file:// !
How can I get at my own page, short of pushing it to an external server?
Use a local server. Just open a command prompt, cd to your webpages and then type
python -m SimpleHTTPServer
Then go to
http://localhost:8000
I don't think extensions are allowed to run on file:: urls because then an extension could read your hard drive.
If you are doing video or audio then try this node server.
I just downloaded WebGL Inspector 1.13, and it has a setting (under Settings>Extensions>WebGL Inspector) that reads "Allow access to file URLs". Does what it sounds like - all set!

appcache is trying to cache all files

I'm trying to make a appcache file but got some problems... I've added the appcache file to the server, here is its content:
CACHE MANIFEST
CACHE:
scripts/jquery-1.5.1.min.js
But after refreshing the page I got all my web site files missing (styles, js scripts, images etc.), I mean they are not loading anymore and browser always try to get them from local cache. But what I want is just to cache some of them, I don't want to specify ALL my files in the appcache (to CACHE section or to NETWORK section), is this possible?
Don't use the HTML5 app cache for what you are trying to do.
Browsers already cache certain resources from a website and you can choose how the browsers should cache the files by manipulating the HTTP headers. For example, Stack Overflow loads their jQuery library from Google and Google sets the HTTP header: "Expires: Sat, 16 Mar 2013 05:41:47 GMT". Every website that links to this file won't have to download it anymore because the browser will keep it in it's cache for the next year.
For the files on your own website you will have to find out which webserver is running your site. For the Apache webserver follow these instructions, for IIS follow these instructions.