SCRIPT70:IE9 api错误允许拒绝191

时间:2011-10-02 14:12:21

标签: javascript api facebook-graph-api permissions internet-explorer-9

执行FB.login(function(response){})后我在IE9上收到了SCRIPT70错误,并且我没有为此脚本使用iframe。我收到错误:

弹出窗口给我一个

API错误代码:191  API错误说明:指定的URL不归应用程序所有  错误消息:redirect_uri无效:应用程序配置不允许给定URL。

  

all.js,第22行第4250字符   错误发生在setLoadedNode函数中   其中包含:

FB.provide('', {
    ui: function (f, b) {
        if (!f.method) {
            FB.log('"method" is a required parameter for FB.ui().');
            return null;
        }
        if ((f.method == 'permissions.request' || f.method == 'permissions.oauth') && (f.display == 'iframe' || f.display == 'dialog')) {
            var h;
            var i;
            if (FB._oauth) {
                h = f.scope;
                i = h.split(/\s|,/g);
            } else {
                h = f.perms;
                i = h.split(',');
            }
            for (var e = 0; e < i.length; e++) {
                var g = FB.String.trim(i[e]);
                if (g && !FB.initSitevars.iframePermissions[g]) {
                    f.display = 'popup';
                    break;
                }
            }
        }
        var a = FB.UIServer.prepareCall(f, b);
        if (!a) return null;
        var d = a.params.display;
        if (d === 'dialog') {
            d = 'iframe';
        } else if (d === 'none') d = 'hidden';
        var c = FB.UIServer[d];
        if (!c) {
            FB.log('"display" must be one of "popup", ' + '"dialog", "iframe", "touch", "async", "hidden", or "none"');
            return null;
        }
        c(a);
        return a.dialog;
    }
});
FB.provide('UIServer', {
    Methods: {},
    _loadedNodes: {},
    _defaultCb: {},
    _resultToken: '"xxRESULTTOKENxx"',
    _forceHTTPS: false,
    genericTransform: function (a) {
        if (a.params.display == 'dialog' || a.params.display == 'iframe') {
            a.params.display = 'iframe';
            a.params.channel = FB.UIServer._xdChannelHandler(a.id, 'parent.parent');
        }
        return a;
    },
    prepareCall: function (h, b) {
        var g = h.method.toLowerCase(),
            f = FB.copy({}, FB.UIServer.Methods[g]),
            e = FB.guid(),
            c = (f.noHttps !== true) && (FB._https || (g !== 'auth.status' && g != 'login.status'));
        FB.UIServer._forceHTTPS = c;
        FB.copy(h, {
            api_key: FB._apiKey,
            app_id: FB._apiKey,
            locale: FB._locale,
            sdk: 'joey',
            access_token: c && FB.getAccessToken() || undefined
        });
        h.display = FB.UIServer.getDisplayMode(f, h);
        if (!f.url) f.url = 'dialog/' + g;
        var a = {
            cb: b,
            id: e,
            size: f.size || FB.UIServer.getDefaultSize(),
            url: FB.getDomain(c ? 'https_www' : 'www') + f.url,
            forceHTTPS: c,
            params: h,
            name: g,
            dialog: new FB.Dialog(e)
        };
        var j = f.transform ? f.transform : FB.UIServer.genericTransform;
        if (j) {
            a = j(a);
            if (!a) return;
        }
        var d = f.getXdRelation || FB.UIServer.getXdRelation;
        var i = d(a.params);
        if (!(a.id in FB.UIServer._defaultCb) && !('next' in a.params)) a.params.next = FB.UIServer._xdResult(a.cb, a.id, i, true);
        if (i === 'parent') a.params.channel_url = FB.UIServer._xdChannelHandler(e, 'parent.parent');
        a = FB.UIServer.prepareParams(a);
        return a;
    },
    prepareParams: function (a) {
        var c = a.params.method;
        if (!FB.Canvas.isTabIframe()) delete a.params.method;
        if (FB.TemplateUI && FB.TemplateUI.supportsTemplate(c, a)) {
            if (FB.reportTemplates) console.log("Using template for " + c + ".");
            FB.TemplateUI.useCachedUI(c, a);
        } else {
            a.params = FB.JSON.flatten(a.params);
            var b = FB.QS.encode(a.params);
            if (FB.UIServer.urlTooLongForIE(a.url + b)) {
                a.post = true;
            } else if (b) a.url += '?' + b;
        }
        return a;
    },
    urlTooLongForIE: function (a) {
        return a.length > 2000;
    },
    getDisplayMode: function (a, b) {
        if (b.display === 'hidden' || b.display === 'none') return b.display;
        if (FB.Canvas.isTabIframe() && b.display !== 'popup') return 'async';
        if (FB.UA.mobile() || b.display === 'touch') return 'touch';
        if (!FB.getAccessToken() && b.display == 'dialog' && !a.loggedOutIframe) {
            FB.log('"dialog" mode can only be used when the user is connected.');
            return 'popup';
        }
        if (a.connectDisplay && !FB._inCanvas) return a.connectDisplay;
        return b.display || (FB.getAccessToken() ? 'dialog' : 'popup');
    },
    getXdRelation: function (b) {
        var a = b.display;
        if (a === 'popup' || a === 'touch') return 'opener';
        if (a === 'dialog' || a === 'iframe' || a === 'hidden' || a === 'none') return 'parent';
        if (a === 'async') return 'parent.frames[' + window.name + ']';
    },
    popup: function (b) {
        var a = typeof window.screenX != 'undefined' ? window.screenX : window.screenLeft,
            i = typeof window.screenY != 'undefined' ? window.screenY : window.screenTop,
            g = typeof window.outerWidth != 'undefined' ? window.outerWidth : document.documentElement.clientWidth,
            f = typeof window.outerHeight != 'undefined' ? window.outerHeight : (document.documentElement.clientHeight - 22),
            k = FB.UA.mobile() ? null : b.size.width,
            d = FB.UA.mobile() ? null : b.size.height,
            h = (a < 0) ? window.screen.width + a : a,
            e = parseInt(h + ((g - k) / 2), 10),
            j = parseInt(i + ((f - d) / 2.5), 10),
            c = [];
        if (k !== null) c.push('width=' + k);
        if (d !== null) c.push('height=' + d);
        c.push('left=' + e);
        c.push('top=' + j);
        c.push('scrollbars=1');
        if (b.name == 'permissions.request' || b.name == 'permissions.oauth') c.push('location=1,toolbar=0');
        c = c.join(',');
        if (b.post) {
            FB.UIServer.setLoadedNode(b, window.open('about:blank', b.id, c));
            FB.Content.submitToTarget({
                url: b.url,
                target: b.id,
                params: b.params
            });
        } else FB.UIServer.setLoadedNode(b, window.open(b.url, b.id, c));
        if (b.id in FB.UIServer._defaultCb) FB.UIServer._popupMonitor();
    },
    setLoadedNode: function (a, b) {
        FB.UIServer._loadedNodes[a.id] = b;
        if (a.params) b.fbCallID = a.id;
    },
    getLoadedNode: function (a) {
        return FB.UIServer._loadedNodes[a.id];
    },
    hidden: function (a) {
        a.className = 'FB_UI_Hidden';
        a.root = FB.Content.appendHidden('');
        FB.UIServer._insertIframe(a);
    },
    iframe: function (a) {
        a.className = 'FB_UI_Dialog';
        var b = function () {
                FB.UIServer._triggerDefault(a.id);
            };
        a.root = FB.Dialog.create({
            onClose: b,
            closeIcon: true,
            classes: (FB.UA.iPad() ? 'centered' : '')
        });
        if (!a.hideLoader) FB.Dialog.showLoader(b, a.size.width);
        FB.Dom.addCss(a.root, 'fb_dialog_iframe');
        FB.UIServer._insertIframe(a);
    },
    async: function (a) {
        a.frame = window.name;
        delete a.url;
        delete a.size;
        FB.Arbiter.inform('showDialog', a);
    },
    getDefaultSize: function () {
        if (FB.UA.mobile()) if (FB.UA.iPad()) {
            return {
                width: 500,
                height: 590
            };
        } else {
            var a = window.innerWidth / window.innerHeight > 1.2;
            return {
                width: window.innerWidth,
                height: Math.max(window.innerHeight, (a ? screen.width : screen.height))
            };
        }
        return {
            width: 575,
            height: 240
        };
    },
    _insertIframe: function (b) {
        FB.UIServer._loadedNodes[b.id] = false;
        var a = function (c) {
                if (b.id in FB.UIServer._loadedNodes) FB.UIServer.setLoadedNode(b, c);
            };
        if (b.post) {
            FB.Content.insertIframe({
                url: 'about:blank',
                root: b.root,
                className: b.className,
                width: b.size.width,
                height: b.size.height,
                id: b.id,
                onInsert: a,
                onload: function (c) {
                    FB.Content.submitToTarget({
                        url: b.url,
                        target: c.name,
                        params: b.params
                    });
                }
            });
        } else FB.Content.insertIframe({
            url: b.url,
            root: b.root,
            className: b.className,
            width: b.size.width,
            height: b.size.height,
            id: b.id,
            name: b.frameName,
            onInsert: a
        });
    },
    _handleResizeMessage: function (b, a) {
        var c = FB.UIServer._loadedNodes[b];
        if (a.height) c.style.height = a.height + 'px';
        if (a.width) c.style.width = a.width + 'px';
        FB.Arbiter.inform('resize.ack', a || {}, 'parent.frames[' + c.name + ']', true);
        if (!FB.Dialog.isActive(c)) FB.Dialog.show(c);
    },
    _triggerDefault: function (a) {
        FB.UIServer._xdRecv({
            frame: a
        }, FB.UIServer._defaultCb[a] ||
        function () {});
    },
    _popupMonitor: function () {
        var a;
        for (var b in FB.UIServer._loadedNodes) if (FB.UIServer._loadedNodes.hasOwnProperty(b) && b in FB.UIServer._defaultCb) {
            var c = FB.UIServer._loadedNodes[b];
            try {
                if (c.tagName) continue;
            } catch (d) {}
            try {
                if (c.closed) {
                    FB.UIServer._triggerDefault(b);
                } else a = true;
            } catch (e) {}
        }
        if (a && !FB.UIServer._popupInterval) {
            FB.UIServer._popupInterval = window.setInterval(FB.UIServer._popupMonitor, 100);
        } else if (!a && FB.UIServer._popupInterval) {
            window.clearInterval(FB.UIServer._popupInterval);
            FB.UIServer._popupInterval = null;
        }
    },
    _xdChannelHandler: function (b, c) {
        var a = (FB.UIServer._forceHTTPS && FB.UA.ie() !== 7);
        return FB.XD.handler(function (d) {
            var e = FB.UIServer._loadedNodes[b];
            if (!e) return;
            if (d.type == 'resize') {
                FB.UIServer._handleResizeMessage(b, d);
            } else if (d.type == 'hide') {
                FB.Dialog.hide(e);
            } else if (d.type == 'rendered') {
                var f = FB.Dialog._findRoot(e);
                FB.Dialog.show(f);
            } else if (d.type == 'fireevent') FB.Event.fire(d.event);
        }, c, true, null, a);
    },
    _xdNextHandler: function (a, b, d, c) {
        if (c) FB.UIServer._defaultCb[b] = a;
        return FB.XD.handler(function (e) {
            FB.UIServer._xdRecv(e, a);
        }, d) + '&frame=' + b;
    },
    _xdRecv: function (b, a) {
        var c = FB.UIServer._loadedNodes[b.frame];
        try {
            if (FB.Dom.containsCss(c, 'FB_UI_Hidden')) {
                window.setTimeout(function () {
                    c.parentNode.parentNode.removeChild(c.parentNode);
                }, 3000);
            } else if (FB.Dom.containsCss(c, 'FB_UI_Dialog')) {
                FB.Dialog.remove(c);
                if (FB.TemplateUI && FB.UA.mobile()) FB.TemplateUI.populateCache();
            }
        } catch (d) {}
        try {
            if (c.close) {
                c.close();
                FB.UIServer._popupCount--;
            }
        } catch (e) {}
        delete FB.UIServer._loadedNodes[b.frame];
        delete FB.UIServer._defaultCb[b.frame];
        a(b);
    },
    _xdResult: function (a, b, d, c) {
        return (FB.UIServer._xdNextHandler(function (e) {
            a && a(e.result && e.result != FB.UIServer._resultToken && FB.JSON.parse(e.result));
        }, b, d, c) + '&result=' + encodeURIComponent(FB.UIServer._resultToken));
    }
});

我添加了整条线22美化 有人有这个问题吗?

谢谢

1 个答案:

答案 0 :(得分:0)

当前的url路径似乎必须位于您在facebook应用程序设置中设置的“canvas url”下方,以便auth对话框能够正常工作。

这很奇怪,因为类似的小部件可以在任何地方正常工作!