As mentioned here, we can use "disabled" attribute in <link>
tag to disable the related CSS rules. Will it also flush the CSS rules from the browser memory? If no, please suggest a way that can do so.
Asked
Active
Viewed 181 times
-1

Community
- 1
- 1

Ankur Gupta
- 326
- 3
- 12
-
4What exactly do you mean? Is there some problem you're trying to solve? – jonrsharpe Feb 14 '17 at 17:44
-
@jonrsharpe, I think they might be trying to get rid of the CSS from the cache. (Don't know why, but hey.) – FibreChips Feb 14 '17 at 17:46
-
1I think everytime he wants to load css freshly, not from the cache – Kiran Reddy Feb 14 '17 at 17:49
-
@FibreChips: I am making an AJAX based page, part of which will load and unload the views. So, while unloading a view, I want to unload the related CSS rules. – Ankur Gupta Feb 14 '17 at 17:50
-
@AnkurGupta well that isn't necessary at all. The browser will manage it's memory accordingly, and so it shouldn't ever be an issue if RAM management is your worry. And your CSS rules shouldn't be interfering with each other if that's the case. (If designed properly; if they are interfering with each other, I'd suggest modifying your CSS. – FibreChips Feb 14 '17 at 17:53
-
@FibreChips: Actually I am making a client on browser deployed over set top box with very limited resources. Thats why, memory is my concern. Hope you can understand. – Ankur Gupta Feb 14 '17 at 17:58
-
@AnkurGupta I get that, however a few KB of CSS shouldn't be a problem. And again, the browser should do a fine job of managing its resources, so I wouldn't worry about getting rid of the "old" CSS. (Also, AFAIK there is no way to force a browser to purge part of it's memory while still on the same page.) – FibreChips Feb 14 '17 at 18:06
-
Such a great question. So sad so many afraid of what they don't understand. Sigh. – Jack G Jul 06 '17 at 22:14
1 Answers
0
If you're looking to remove css from a browser/machines cache, then you're going to need to edit your .htaccess
file.
Take a look at this link for more information on setting those headers.
(This is assuming you're using a "standard" server, and not something like Node.js. For something without .htaccess
, you could just append a random query-string to every CSS request, forcing the browser to download it fresh from the server, but this might have unwanted performance side effects.)

FibreChips
- 124
- 3
- 12