More in this section
Forums / Developing with Sitefinity / Clear Designer JavaScript Cache Programatically

Clear Designer JavaScript Cache Programatically

The forums are in read-only mode. In case that you want to directly contact the Progress Sitefinity team use the support center. In our Google Plus group you can find more than one thousand Sitefinity developers discussing different topics. For the Stack Overflow threads don’t forget to use the “Sitefinity” tag.
7 posts, 0 answered
  1. kasun
    kasun avatar
    2 posts
    Registered:
    23 Mar 2015
    06 Sep 2017
    Link to this post

    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

     

  2. Jonathan
    Jonathan avatar
    119 posts
    Registered:
    19 Dec 2012
    13 Sep 2017 in reply to kasun
    Link to this post
    Are you having issues with javascript files not loading the correct versions?
  3. kasun
    kasun avatar
    2 posts
    Registered:
    23 Mar 2015
    13 Sep 2017 in reply to Jonathan
    Link to this post
    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. 
  4. Jonathan
    Jonathan avatar
    119 posts
    Registered:
    19 Dec 2012
    26 Sep 2017
    Link to this post

    Have you taken a look at this article.  I believe the concepts can be applied to the issue you have.

     

    http://www.sitefinity.com/blogs/peter-filipov-blog/2017/09/18/solving-caching-issues-in-the-sitefinity-mvc-navigation-widget 

  5. Clinton
    Clinton avatar
    14 posts
    Registered:
    27 Feb 2014
    29 Sep 2017 in reply to Jonathan
    Link to this post

    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

  6. Clinton
    Clinton avatar
    14 posts
    Registered:
    27 Feb 2014
    22 Nov 2017 in reply to Jonathan
    Link to this post

    Hi Jonathan,

    Any update on this?

    Thanks,
    Clinton

  7. Jonathan
    Jonathan avatar
    119 posts
    Registered:
    19 Dec 2012
    22 Nov 2017
    Link to this post

    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. 

7 posts, 0 answered