Enable Visio Services data refresh using script

In a previous post I showed you how to edit the web.config file to disable the data refresh prompt so that diagrams will always refresh when rendered, https://blogs.msdn.com/b/chhopkin/archive/2010/09/28/force-data-refresh-for-published-diagrams.aspx.  This method affects all diagrams that are viewed in the browser or rendered in the Visio Web Access web part.

If you do not have access to the web.config or if you only want to enable this on a spceific page you can use the included script which triggers refresh for the diagram when the user navigates to the diagram.

For a web part page that includes the Visio Web Access web part you can add an HTML Forms web part and copy the attached JavaScript into its source.  The source that I attached to this article also includes my VWA helpers library which contains my enableRefresh function.  It also includes a copy of the standard JQuery library.  Typically I upload these two libraries to a SiteAssets library and reference them from within my script as you can see in the AutoRefresh.js file with the included attachment.

autorefresh_script.zip