Question

I have an issue with the Chrome browser, and found the next "solution" in this site:

function OnIframeLoadFinish() {
ULSvmd:
    ;
    var picker;    
    if (typeof this.Picker != 'undefined')
        picker = this.Picker;
    if (picker != null && typeof picker.readyState != 'undefined' && picker.readyState != null && picker.readyState == "complete") {
        document.body.scrollLeft = g_scrollLeft;
        document.body.scrollTop = g_scrollTop;
        g_scrollTop = document.getElementById('s4-workspace').scrollTop;
        picker.style.display = "block";
        if (typeof document.frames != 'undefined' && Boolean(document.frames)) {  /* "document.frames" doesn't work on chrome use "window.frames" instead*/
            var frame = document.frames[picker.id];    
            if (frame != null && typeof frame.focus == 'function')
                frame.focus();
        }
        else {
            picker.focus();
        }
    }
    setTimeout(function(){
        document.getElementById('s4-workspace').scrollTop = g_scrollTop;
    }, 1);
}

the thing is that this code works perfectly in Chrome. But once I paste it, now it is making the jump in Internet Explorer (and without this code, the jump only happens in Chrome).. So I'd like to know an answer that works in both browsers!.

I tried putting an if with a code that recognizes the browser so it applies only when you are using Chrome, but it didn't work, it's still making the jump in IE whenever I paste the code above.. I need help 9_9

Was it helpful?

Solution

Okay, so I found the answer.. in case somebody wants to know: When I put the condition I did it the wrong way in first instance, I was putting the condition OUTSIDE the function OnIframeLoadFinish(), but the code works when putting the condition INSIDE the function:

function OnIframeLoadFinish() {

    if (!!window.chrome) {
        ULSvmd:
        ;
        var picker;
        if (typeof this.Picker != 'undefined')
            picker = this.Picker;
        if (picker != null && typeof picker.readyState != 'undefined' && picker.readyState != null && picker.readyState == "complete") {
            document.body.scrollLeft = g_scrollLeft;
            document.body.scrollTop = g_scrollTop;
            g_scrollTop = document.getElementById('s4-workspace').scrollTop;
            picker.style.display = "block";
            if (typeof document.frames != 'undefined' && Boolean(document.frames)) {
                var frame = document.frames[picker.id];
                if (frame != null && typeof frame.focus == 'function')
                    frame.focus();
            }
            else {
                picker.focus();
            }
        }
        setTimeout(function () {
            document.getElementById('s4-workspace').scrollTop = g_scrollTop;
        }, 1);
    }
}

the thing is that the function will always run, independently of any condition, so that's why the "if you're using chrome" condition only works inside the function

Licensed under: CC-BY-SA with attribution
Not affiliated with sharepoint.stackexchange
scroll top