Access Denied error when using AJAX accordion in Iframe

posted in: Uncategorized | 0

johnWeeGo.jpgI came across this today when setting up a Virtual Earth map to run in an Iframe on another site. The issue is the content of the Iframe is on another domain and any calls to the ajax helper function “Sys.UI.getLocation” under IE will throw the error as it attempts to access “top.document.documentElement.scrollLeft”.

The solution was posted back in Jan:

Basically you have to replace the IE solution in the ajax js file with:

Sys.UI.DomElement.getLocation = function(element) {
    if (element.self || element.nodeType === 9) return new Sys.UI.Point(0,0);
    var clientRect = element.getBoundingClientRect();
    if (!clientRect) {
        return new Sys.UI.Point(0,0);
    var ownerDocument = element.document.documentElement;
    var offsetX = clientRect.left - 2 + ownerDocument.scrollLeft,
        offsetY = - 2 + ownerDocument.scrollTop;
    try {
        var f = element.ownerDocument.parentWindow.frameElement || null;
        if (f) {
            var offset = 2 - (f.frameBorder || 1) * 2;
            offsetX += offset;
            offsetY += offset;
    catch(ex) {
    return new Sys.UI.Point(offsetX, offsetY);

Fortunatly I am already running a specific location of the file using:

after problems we had early in the year with sessionless web farms and asp.ajax.