Friday, October 02, 2009

SharePoint IE 8 Popup Issue

Editing the SharePoint pages through the browser started throwing a pop-up “Are you sure you want to navigate away from this page?” The pop up will be shown after around 30 seconds, making the page editing slower and frustrating. This popup started showing up after I upgraded to IE8.

To remove the popup, you need to remove the body onUnload event handler. Sample code snippet to do the same:

<script type="text/javascript">

function UnloadHandler()
document.body.onUnload = "";

You can reduce the code snipped to one line by adding this to the bottom you’re your master page, just before HTML closing tag.

document.body.onUnload = "";

However, _spBodyOnLoadFunctionNames.push() is the preffered way to call your JavaScript function on client side page load.

Other option is to go change your IE settings and disable Enable native XMLHTTP support.

Tool->Internet Options->Advanced and disable ‘Enable native XMLHTTP support’

The JavaScript workaround will fix issue for all the users, the IE settings need to be done on every user’s machine trying to edit the page.

No comments: