From 22d74421e37c6743702e783d81018450516091bc Mon Sep 17 00:00:00 2001 From: gorhill Date: Mon, 8 May 2017 11:49:48 -0400 Subject: [PATCH] fix #2594 --- src/js/assets.js | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/src/js/assets.js b/src/js/assets.js index c15258031..9eb1e9bdc 100644 --- a/src/js/assets.js +++ b/src/js/assets.js @@ -65,7 +65,20 @@ var fireNotification = function(topic, details) { /******************************************************************************/ api.fetchText = function(url, onLoad, onError) { - var actualUrl = reIsExternalPath.test(url) ? url : vAPI.getURL(url); + var isExternal = reIsExternalPath.test(url), + actualUrl = isExternal ? url : vAPI.getURL(url); + + // https://github.com/gorhill/uBlock/issues/2592 + // Force browser cache to be bypassed, but only for resources which have + // been fetched more than one hour ago. + if ( isExternal ) { + var queryValue = Math.floor(Date.now() / 7200000); + if ( actualUrl.indexOf('?') === -1 ) { + actualUrl += '?_=' + queryValue; + } else { + actualUrl += '&_=' + queryValue; + } + } if ( typeof onError !== 'function' ) { onError = onLoad;