SharePoint 2010 在chrome 谷歌浏览器中滚动条的问题

SharePoint and Chrome

 

A few months ago I posted an entry called SharePoint 2010 Scrolling detailing a method to get scrolling working on less supported browsers in SharePoint 2010. Along with some background on to why the method works.

So, I’ve had reason recently to revisit Chrome and SharePoint compatibility specifically as of late. In the process a different fix came out of it. One that is less heavy-handed. But more importantly I found out that the cause of the scrolling inconsistency on some browsers like iOS Safari and Chrome is NOT due to the causes that have been previously documented by other bloggers or myself. The cause is in fact a timing issue around execution of a specific bit of very important onload JavaScript.

The bit that doesn’t execute (and causes a systemic issue, one of the issues it causes is the scrolling weirdness), is:

body οnlοad=”if(typeof(_spBodyOnLoadWrapper) != ‘undefined’; _spBodyOnLoadWrapper();”

What this line means is basically if the page has loaded the onloadwrapper function from init.js. This onloadwrapper does a bunch of things, such as loading the ECMAScript for support SP.JS, executes page JavaScript for any onload events, and any client interactivity. So basically when this doesn’t execute pretty much no client side code from SharePoint can or will work, or any script that you have that relies on any of it. Scrolling is just the tip of the ice berg. Now for the good news, it’s easy to fix (I have a case in with Microsoft to look at including the fix in a future cumulative update).

Lastly, before showing the work around. SharePoint is not the only site affected by this issue, if you have a site loading JavaScript dynamically or via lazy loading and within that JavaScript have defined an OnLoad function, you can also run in to this issue.

 

 
 
$(document).ready(function()
{
    Reinit();
});

function Reinit()
{
    //verify we have finished loading init.js
    if(typeof(_spBodyOnLoadWrapper) != 'undefined')
    {
        //verify we have not already initialized the onload wrapper
        if(_spBodyOnloadCalled == false)
        {
            //initialize onload functions
            _spBodyOnLoadWrapper();
        }
    }
    //wait for 10ms and try again if init.js has not been loaded
    else
    {
        InitTimer();
    }
}

function InitTimer()
{
    setTimeout(Reinit,10);
}

 

转载于:https://www.cnblogs.com/ahghy/archive/2013/01/03/2842891.html

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值