Aug 12, 2020 5:56 AM - edited Aug 12, 2020 6:08 AM
Hi guys,
I thought, I'd share with you a bookmarklet that I made for HubSpot caching resolutions.
What this does
Add this code as a book mark and then this will add a query string with a random number to clear cache. If it already exists it will update it.
javascript:void function(){!function(){var a=window.location.href;window.location=function(a,b,c){c||(c=window.location.href);var d,e=new RegExp("([%3F%26])"+a+"=.*%3F(%26|%23|$)(.*)","gi");if(e.test(c))return null==b%3F(d=c.split("%23"),c=d[0].replace(e,"$1$3").replace(/(%26|\%3F)$/,""),void 0!==d[1]%26%26null!==d[1]%26%26(c+="%23"+d[1]),c):c.replace(e,"$1"+a+"="+b+"$2$3");if(null!=b){var f=-1===c.indexOf("%3F")%3F"%3F":"%26";return d=c.split("%23"),c=d[0]+f+a+"="+b,void 0!==d[1]%26%26null!==d[1]%26%26(c+="%23"+d[1]),c}return c}("hsCacheBuster",Math.round(99999*Math.random()),a)}()}();
javascript: (function() { function UpdateQueryString(key, value, url) { if (!url) url = window.location.href; var re = new RegExp("([?&])" + key + "=.*?(&|#|$)(.*)", "gi"), hash; if (re.test(url)) { if (typeof value !== 'undefined' && value !== null) { return url.replace(re, '$1' + key + "=" + value + '$2$3'); } else { hash = url.split('#'); url = hash[0].replace(re, '$1$3').replace(/(&|\?)$/, ''); if (typeof hash[1] !== 'undefined' && hash[1] !== null) { url += '#' + hash[1]; } return url; } } else { if (typeof value !== 'undefined' && value !== null) { var separator = url.indexOf('?') !== -1 ? '&' : '?'; hash = url.split('#'); url = hash[0] + separator + key + '=' + value; if (typeof hash[1] !== 'undefined' && hash[1] !== null) { url += '#' + hash[1]; } return url; } else { return url; } } } var currentUrl = window.location.href window.location = UpdateQueryString('hsCacheBuster', Math.round(Math.random() * 999999), currentUrl); })()
Aug 12, 2020 10:23 AM
Thank you for sharing @SandyG1! really interesting
![]() | ¿Sabías que la Comunidad está disponible en Español? ¡Participa hoy en conversaciones en el idioma de tu preferencia,cambiando el idioma en tus configuraciones! Did you know that the Community is available in other languages? Join regional conversations by changing your language settings ! |