Caching specific Javascript and CSS files

前端 未结 3 1221
一生所求
一生所求 2020-11-28 10:32

How can I cache a few specific JavaScript & CSS files. I found advice from this site to put this in my .htaccess file

AddOutputFilter DEFLAT         


        
3条回答
  •  孤城傲影
    2020-11-28 10:35

    You can configure IIS to cache specific files by extension. For example:

    Select the folder where your css/js files reside and then click on Output Caching. enter image description here

    Then add the file extensions that you want to cache:

    enter image description here

    I don't think you can specify which ones to cache on a per file basis unless you write an http handler module to add the appropriate headers for each file independently, but from IIS this is how is done.

    Then you can verify that you are getting 304 responses using firebug / fiddler or your tool of choice.

    I hope this is helpful.

提交回复
热议问题