You are here: Foswiki>Tasks Web>Item13950 (31 Jan 2018, GeorgeClark)Edit Attach

Item13950: Refresh cache needs better controls, to minimize bot clicks.

Priority: Normal
Current State: Closed
Released In: 2.1.1
Target Release: patch
Applies To: Engine
Component: PageCache
Branches: master Release02x01 Item13897 Item14033 Item14380 Item14537
Reported By: GeorgeClark
Waiting For:
Last Change By: GeorgeClark
Change the refresh cache link to a javascript based control to minimize bot clicks:
diff --git a/PatternSkin/templates/view.pattern.tmpl b/PatternSkin/templates/view.pattern.tmpl
index 4b75c90..a0ac34b 100644
--- a/PatternSkin/templates/view.pattern.tmpl
+++ b/PatternSkin/templates/view.pattern.tmpl
@@ -70,7 +70,7 @@
 }%%TMPL:DEF{"cacheinfo"}%%IF{"{Cache}{Enabled} and $CACHEABLE != 'off'" 
   then="<span class='patternCacheInfo'>
           - %MAKETEXT{"This page was cached on [_1]." args="%SERVERTIME%"}%
-          %MAKETEXT{"Get a fresh version <a href='[_1]' rel='nofollow'>here</a>." args="%SCRIPTURLPATH{view}%/%BASEWEB%/%BASETOPIC%?refresh=cache"}%
+          %MAKETEXT{"Get a fresh version <a href='javascript:void(0)' rel='nofollow' onclick='window.location.href=[_1]' >here.</a>" args="$quot%SCRIPTURLPATH{"view" topic="%BASEWEB%.%BASETOPIC%" refresh="cache"}%$quot"}%

In addition, the full refresh should have additional controls.

-- GeorgeClark - 10 Feb 2016

I don't think this is a good approach to code an onclick handler for that purpose. Instead I'd only render a refresh button for authenticated users.

%IF{"context authenticated"
   then="%MAKETEXT{"Get a fresh version <a href='[_1]'>here</a>." args="%SCRIPTURLPATH{view}%/%BASEWEB%/%BASETOPIC%?refresh=cache"}%"

-- MichaelDaum - 10 Feb 2016
Topic revision: r11 - 31 Jan 2018, GeorgeClark
The copyright of the content on this website is held by the contributing authors, except where stated elsewhere. See Copyright Statement. Creative Commons License    Legal Imprint    Privacy Policy