Clear Designer JavaScript Cache Programatically - Front- & Back-End Development - Front- & Back-End Development - Progress Community
 Front- & Back-End Development

Clear Designer JavaScript Cache Programatically

  • Clear Designer JavaScript Cache Programatically
  • Hello, 

    I'm trying to find a way to clear the browser cache of all the "designerview-simple.js" files for the MVC widgets that we are building. 

    The only solution we came up with to attach a unique query string to the end of the js file so when the file get attached to the document browser will recognize the file as a new file and download a fresh copy of it.  

    Here is the code : 

    @Html.Script(Url.WidgetContent("Mvc/Scripts/mywidget/mywidgetview.js?version=" +VersionNumber), "top", false)

     

    Now we want to implement the same functionality to the "designerview-simple.js" .

    However we are not able to locate where the "designerview-simple.js" loading from or how its loaded , so we can add this code and the cache will be clear. 

    OR 

    Is there a better solution for this issues ? 

    Please let us know.

    Thank you in Advance 

    Kasun Peiris

     

  • Are you having issues with javascript files not loading the correct versions?
  • Js files are loading but they are cached. Im not able to add a version number to the end of the file url as I don't know where are they loading. 
  • Have you taken a look at this article.  I believe the concepts can be applied to the issue you have.

     

    www.sitefinity.com/.../solving-caching-issues-in-the-sitefinity-mvc-navigation-widget 

  • Hi Jonathan,

    I think what Kasun wants here is a way to force invalidate the client-side cache. The article you linked is for invalidating server-side cache.

    Our browsers cache specific URLs based on their name, this is why in Kasun's example above he adds the version number to the URL to force the browser into retrieving a fresh copy of the file. This version number will increase based on the changes he makes to the file.

    Is there any way to append a query string to the URL of the designerview-simple.js so the browser is forced to download a new copy? Similar to that of the jQuery Ajax "cache" property that adds a query string value "_" set to the current time stamp.

    Let us know!

    Regards,
    Clinton

  • Hi Jonathan,

    Any update on this?

    Thanks,
    Clinton

  • Those js files are loaded through the feather framework, so you would need to go locate the usage on github.  Here is the code that seems to be loading the designer references. Since it is an internal class you would need to form the repo and do your edits.  For development purposes you might turn of cache for the site, it will be slower page loads but you won't be face with the issue as much.  I have also found the restarting the site via a web.config 'bump' those designers usually refresh. 

    If this is a production issue you might want to make sure there are no other caching mechanisms on the site.