How to prevent SharePoint refreshing the page when you close a document

When you open a document in SharePoint and then close it the SharePoint page in IE auto refreshes – this is quite handy if you’re editing metadata in your document and want the changes refreshed when you save the document back but…

I had a requirement to disable this functionality for one particular site – here’s how to prevent SharePoint refreshing the page when you close a document.

Create a file called disablesprefresh.js and save it in the LAYOUTS\1033 directory – for me this is located at C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\14\TEMPLATE\LAYOUTS\1033

If you want to disable the page refresh for ALL pages add this line to disablesprefresh.js:

g_varSkipRefreshOnFocus = 1;

I only wanted to disable the refresh for one page so i have this in my disablesprefresh.js:

if (window.location == ‘http://<portal>/<site>/default.aspx’){g_varSkipRefreshOnFocus = 1;}

Next, edit your master page and add these two lines:

 

<SharePoint:ScriptLink language=”javascript” name=”core.js” Defer=”true” runat=”server”/>

<SharePoint:ScriptLink language=”javascript” name=”disablesprefresh.js” Defer=”true” runat=”server”/>

 

I placed them just below this line:

<asp:ScriptManager id=”ScriptManager” runat=”server” EnablePageMethods=”false” EnablePartialRendering=”true” EnableScriptGlobalization=”false” EnableScriptLocalization=”true”>

Check-in your master page\approve and you’re all done – awesome!

 

This entry was posted in SharePoint 2010. Bookmark the permalink.

6 Responses to How to prevent SharePoint refreshing the page when you close a document

  1. Thanks. Awesome post. Saved my life!

  2. open office says:

    hi!,I like your writing very a lot! proportion we communicate more approximately your article on AOL? I require an expert in this space to resolve my problem. May be that is you! Having a look forward to look you.

  3. Pingback: Buy Facebook Fans

  4. Pingback: invest liberty reserve

  5. Sorry for my bad english. Thank you so much for your good post. Your post helped me in my college assignment, If you can provide me more details please email me.
    Recipes for diabetics

  6. I always like to have a read about such things, my blog is related if you want to have a look round it please feel free. I have added yours to my bookmarks.
    My website is about Stock quote

Leave a Reply

Your email address will not be published. Required fields are marked *

*

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>

Please leave these two fields as-is:

Protected by Invisible Defender. Showed 403 to 4,595 bad guys.