YodaSpow / EmailDevTools

EmailTools
https://codepen.io/spowart/details/abWzBwR
7 stars 1 forks source link

Page Reload with clear cache query for Email OFF #30

Closed YodaSpow closed 5 years ago

YodaSpow commented 5 years ago

Page Reload with clear cache query for Email OFF:

Maybe possible to reload page using the clear cache query as a concatenation:

Maybe even after load do the force refresh (Not really needed but optional)

Clear Cache javascript:location.href=location + '?clearCache=y';

Force Refresh javascript:(function()%7Bvar gcs=function(e,s)%7Bif(typeof e.currentStyle!='undefined')%7Breturn e.currentStyle%5Bs%5D;%7Delse%7Breturn document.defaultView.getComputedStyle(e,null)%5Bs%5D;%7D%7D;var i,j,k,l,x,y,z,bi;z=%5B%5D;z.push(self);z.concat(self.frames);y=new Date().getTime();for(k=0,l=z.length;k<l;k++)%7Bx=z%5Bk%5D.document.getElementsByTagName('*');for(i=0,j=x.length;i<j;i++)%7Bbi=gcs(x%5Bi%5D,'backgroundImage');if(bi.indexOf(')')>-1)%7Bbi=bi.replace(/'/gi,'').replace(/"/gi,'');x%5Bi%5D.style.backgroundImage=bi.replace(')',(bi.indexOf('?')==-1?'?':'')+y+')');%7D%7D;x=z%5Bk%5D.document.getElementsByTagName('link');for(i=0,j=x.length;i<j;i++)%7Bx%5Bi%5D.href+=(x%5Bi%5D.href.indexOf('?')==-1?'?':'')+y;%7D;x=z%5Bk%5D.document.getElementsByTagName('img');for(i=0,j=x.length;i<j;i++)%7Bx%5Bi%5D.src+=(x%5Bi%5D.src.indexOf('?')==-1?'?':'')+y;%7D;%7D;%7D)();

Ref: https://meyerweb.com/eric/tools/dencoder/

YodaSpow commented 5 years ago

Working code but does not clear-cache:

        // Clear Cache
        var versionUpdate = (new Date()).getTime();
        var url = window.location.host + window.location.pathname;
        window.location.href = url + "?v=" + versionUpdate;

        // Working
        //window.location.reload(true);
YodaSpow commented 5 years ago

Fixed in: https://github.com/YodaSpow/EmailDevTools/commit/452fb78adc7ebdab558d92771ec30f9112aba8eb