How to auto refresh the share site? Now when someone post an answer in share discussion the user has to refresh the page in order to view the answer. How to auto refresh the page?
3 Answers
There is no pre-defined auto-refresh component in Share. You'll have to code it yourself.
Option 1: Auto-Poll the server every x seconds via JavaScript, e.g. use YAHOO.lang.later(...)
Option 2: Write your own Alfresco Policy to trigger a Server-Sent Events + consume such event in Share
Option 3: Introduce WebSockets
All Options will require deep knowledge of JavaScript in the Browser, especially YUI & Alfresco's custom Share components & utils. Option 2 & 3 will additionally require deep knowledge of Java & Alfresco's Java Foundation API.

- 4,079
- 1
- 18
- 20
-
Can I use a java script and set the rule in the site ? – samnaction Mar 04 '14 at 09:55
-
you can use a javascript rule to trigger the SSE in option 2 or to emit() in option 3. But both cases are not trivial & JavaScript only as you'll to add SSE/websocket capabilities to Alfresco... – alfrescian Mar 04 '14 at 10:35
-
I think location.reload(); will do the reload of the page rite? – samnaction Mar 04 '14 at 11:50
-
yes, there are several options to reload the current page: -> e.g. http://stackoverflow.com/questions/18967532/window-location-reload-not-working-for-firefox-and-and-chrome Thought you would like to refresh the page for every user if there is a new answer... – alfrescian Mar 04 '14 at 12:04
-
Ya I created the script but how to link the script to the site? I tried `manage rule` but I dont find option to use this script – samnaction Mar 04 '14 at 12:06
-
a rule is the wrong layer. A rule runs in the repo layer. You'll have to change the JS that runs in the browser -> one of the js-Files in share\components\discussions. But please make yourself familar with Share/SURF customizations & subcomponents before. It's NOT recommended to just change the original file – alfrescian Mar 04 '14 at 12:33
-
But the issue is if the entire page reload then it will be really annoying rit? I need to reload the particular area to be reloaded – samnaction Mar 06 '14 at 10:12
-
Are you familiar with JavaScript, YUI & XHR in general? – alfrescian Mar 06 '14 at 15:03
-
No I am a fresher and I have basic knowledge in C and CPP only – samnaction Mar 06 '14 at 16:43
-
Can you tell me in which js files do I need to modify – samnaction Mar 12 '14 at 07:21
-
don't know - one of the js in share\components\discussions- – alfrescian Mar 12 '14 at 08:14
-
don't know, because I still didn't understand your problem in detail... What Alfresco version do your use? Which page (URL) do your use to add an reply? Which data should be loaded but is not loaded? Are you sure that we're talking about the dicusssions site-component? Normally a reply is visible & loaded after adding it - for the current user, other users need to refresh. – alfrescian Mar 12 '14 at 08:21
-
I am using 4.2e CE. The url is like `http://127.0.0.1:8080/share/page/site/sample/discussions-topicview?topicId=post-1394454079256_9467&listViewLinkBack=true` I need to refresh this page at regular interval. – samnaction Mar 12 '14 at 09:19
-
Still I am not clear on this and I am stuck on this. I need something like this https://www.youtube.com/watch?v=cxFhviithUs Watch from 11:00 to 12:00 in the video. When user type an answer it is updated for every users – samnaction Mar 13 '14 at 07:01
I edited toolbar.get.html
in tomcat\webapps\share\WEB-INF\classes\alfresco\site-webscripts\org\alfresco\components\discussions
. I added the following meta tag
<meta http-equiv="Refresh" content="100">
. This is working.

- 1,194
- 1
- 17
- 45
I made a polling timer to update specific data instead of reloading the whole page
However this is more work.

- 96
- 1
- 8
-
-
-
It is just a javascript impl., you need to use it for the data you need updated. In the presence module it retrieves updated site-members presence status, and therefore does not reload the whole page ... – Rasmus Melgaard Mar 17 '14 at 08:34