no-Cache for specific file

Recently I was facing an problem of using cache for my SharePoint pages and files that was being referred to SharePoint Pages. The webpart that I developed used Agile Carousel which uses JSON file. This JSon file will be saved in layouts folder and then will be referred in the masterpage. Googling for removing files from cache, or removing cache only for html file did not help much. So changed the way of thinking to solve the issue, I started to look for Json file cache issues. And voila! I found it…

Andrew Harry has replied in stackoverflow for some other question and I got the answer from it.

just added the below two lines in the place where I call the Json file and it solved it and made me feel so thankful to him…
var noCache = Date();
$.getJSON("/somepage/someaction", { "noCache": noCache }, Callback);

Now, the html file that I refer here did not get stored in cache and was refreshing immediately whenever there was a change in the file.


About gai3kannan

I am working with NCS Pte Ltd as a Lead Consultant I have taken SharePoint as my full time action and thoughts.
This entry was posted in My Own Posts and tagged , , , , , , . Bookmark the permalink.

Leave a Reply

Please log in using one of these methods to post your comment: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s