in SharePoint, SharePoint 2007

IE8 to SharePoint-‘Are you sure you want to navigate away from this page?’

Building ‘easy’ and ‘complex’ user controls or field controls is one of those daily jobs that a SharePoint developer will do when building WCM websites.

Recently whenever I was navigating from the Edit Mode, whether it may be a postback or clicking on a link to a different page, IE8 prompts with this ‘wonderful’ yet ‘awesome’ message:

wcm_editmode_ie_error

Here is my custom field control in edit mode

wcm_editmode_control

So, as you can see in the above screenshot, I have a repeater and then some command arguments – Remove and Sort – Whenever I tried to remove the item or sort, IE8 halts for at least a minute and then prompts me with that message. Clicking on OK does finish the job, but why this message?. This does not happen in IE6, IE7 and Firefox.

Luckily, one of the MSDN forums user Sergioko has found a workaround for this problem:

Hi people,
I have installed Intenet Explorer 8 and started experience a problem. When my publishing page is in Edit mode and I click any link to navigate out to a different page IE8 prints ‘Saving Page Content…’ in its status bar for about 20 seconds and then displays a message box ‘The page took too long to save…’. There were no such error with either IE7 or FireFox. After playing with Javascript debugging, I found that SBN_CallBackHandler() client function of SaveBeforeNavigationControl is not called as it supposed to. It looks like the implementation of XMLHttpRequest object in IE8 is somehow different from the previous release. I’m not sure if it is a bug of IE8 or SharePoint javascript but the problem exists. Fortunatelly, IE8 allows you to turn off its advanced setting ‘Enable native XMLHTTP support’ (enabled by default) in menu Tools/Internet Options/Advanced. It solves the problem but I would like to have more correct solution 🙂  Any ideas?

Yes! Go to Tool->Internet Options->Advanced and disable ‘Enable native XMLHTTP support’ and everything works fine!

wcm_editmode_ie_option

I think the SharePoint Team should be made aware of this bug as this is indeed a show-stopper in regard to user experience in the Edit Mode (which is very common in WCM websites and upgrading to SP2 does not solve this issue)

 

Anyone from the SharePoint Team investigate this issue?

Write a Comment

Comment

Time limit is exhausted. Please reload the CAPTCHA.

  1. Another alternative is to remove the body.unLoad event handler
    <script type="text/javascript">
    _spBodyOnLoadFunctionNames.push("UnloadHandler");

    function UnloadHandler()
    {
    document.body.onUnload = "";
    }
    </script>

  2. The Vinay Bhatia Solution does not work with latest Sharepoint 2007, because the unload handler is set in the body and his handler is replaced.
    Here it is the solution that worked for me:

    In the master page add in the head section:

    <script type="text/javascript">

    function UnloadHandler()
    {
    document.body.onUnload = "";
    window.onbeforeunload = "";
    }
    </script>

    Then just before the </body> tag add :
    <script type="text/javascript">
    UnloadHandler();

    </script>