Wednesday, May 7, 2014

Adding an Auto-Refresh Content Editor Web Part

Adding an Auto-Refresh Content Editor Web Part


Requirement :

You want to create a dashboard which will automatically refresh itself on a regular basis

The Solution

This is easily accomplishable using a SharePoint Web Part and little bit of scripting, JavaScript in this case, to be precise.

How to Accomplish This Task

Start by going to the page you want to edit, and begin editing the page (you Should have at least designer rights to do this).


Add a Web Part to your page (you should already be in a mode like below).




Choose the “Media and Content” Category, “Content Editor” Web Part, and add it to any part of the page (such as the “Header”).















Select the web part and choose “Edit Web Part” from the drop down. A menu will appear on the top right hand side of the page, you may need to scroll over/up to find it












 Set the Title to “Refresh the Web Page”.







Set the Chrome Type to “None”.





Click OK to accept those changes. Then you need to add the script to the web page. To do this, you start by clicking in the section “Click here to add new content”.




A cursor will appear in the content area, however, don’t type anything in the content area, instead simply go to the ribbon and under Editing Tools -> Format Text, select the HTML drop down, and choose “Edit HTML Source”.


 





In the HTML Source box, enter the following JavaScript code.



this script is calling a function after 5 minutes (1000 milliseconds * 60 seconds * 5 minutes = 300000 – this can be any value you choose, just do the math right), which will refresh the page (without showing the annoying, “Are you sure you want to resubmit this page” message that appears in IE when using “window.location.reload”).
Finally, stop editing the page and you will be all done.








Your page should now have a hidden Web Part which will refresh the page every 5 minutes (or whatever number you should choose).

10 comments:

  1. This comment has been removed by the author.

    ReplyDelete
  2. Inspiring writings and I greatly admired what you have to say , I hope you continue to provide new ideas for us all and greetings success always for you..Keep update more information..

    rpa training in Chennai | best rpa training in chennai

    rpa training in pune

    rpa online training | rpa training in bangalore

    ReplyDelete
  3. After seeing your article I want to say that the presentation is very good and also a well-written article with some very good information which is very useful for the readers....thanks for sharing it and do share more posts like this.

    java training in jayanagar | java training in electronic city

    java training in chennai | java training in USA

    ReplyDelete
  4. This is a nice post in an interesting line of content.Thanks for sharing this article, great way of bring this topic to discussion.
    Python training in marathahalli
    Python training institute in pune

    ReplyDelete
  5. Really impressed! Everything is very open and very clear clarification of issues. It contains true facts. Your website is very valuable. Thanks for sharing.
    business analytics course in hyderabad

    ReplyDelete
  6. I am impressed by the information that you have on this blog. It shows how well you understand this subject. data science course in mysore

    ReplyDelete
  7. I have read your article, it is very informative and helpful for me.I admire the valuable information you offer in your articles. Thanks for posting it.. data analytics course in kanpur

    ReplyDelete