弹出 facebook 登录对话框

Popping up facebook login dialog

我正在编写一个库以从 facebook.I 获取短期令牌,我只是制作一个 iframe 并打开其中的对话框。如果用户在没有问题之前登录,但如果用户第一次被 facebook 阻止 iframe 时会提示我的代码如下,我该如何解决这个问题。

function Facebook (params){
    this.url="https://facebook.com/dialog/oauth"+params;
    this.Get=function(){
        var css="position:absolute;top:50%;left:50%;\
        transform:translate(-50%,-50%);width:500px;height:300px;z-index:9999",
        frame=document.createElement("iframe"),
        url=this.url;
        frame.setAttribute("style",css);
        return {
            pop:function(){
                document.getElementsByTagName("body")[0].appendChild(frame);
                alert(url);
                frame.setAttribute("src",url);
            }
        }
    }

}

我通过打开弹出窗口解决了这个问题,如果来自受信任事件(例如点击浏览器)的弹出窗口在从控制台尝试时没有阻止它,无论如何它们都会阻止