如何使用 php SDK 在弹出窗口中显示 facebook 授权窗口?

发布于 2024-12-29 10:50:17 字数 178 浏览 3 评论 0原文

我想在弹出窗口中显示授权窗口,但这似乎不起作用

getLoginUrl(array('scope' => 'read_stream,publish_stream','display' => 'popup'));< /code>

仅使用 php SDK 可以吗?

I want to display authorization window in popup, however this doesn't seem to be working

getLoginUrl(array('scope' => 'read_stream,publish_stream','display' => 'popup'));

Is it possibble with just php SDK?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

荒人说梦 2025-01-05 10:50:17

只有客户端决定页面的加载位置(例如:自己的窗口、父窗口、顶部窗口、弹出窗口),服务器端无法控制或知道这一点。

要打开弹出窗口,您必须调用 window.open() (查找)。如果你确实想做服务器端oauth,你可以在php中使用getLoginUrl()并将其存储在页面中(javascript var / data- attribute等),然后调用window.在正确的时间打开,在弹出窗口中打开登录网址。

但是,您不能随心所欲地打开弹出窗口——您会被阻止。因此,您需要添加一个“登录”链接供用户单击,并为该单击添加一个将打开弹出窗口的事件处理程序。

Only the client side determines where a page gets loaded (for instance: own window, parent window, top window, popup), server side doesn't control or know about that.

To open a popup window you have to call window.open() (look it up). If you do want to do server-side oauth, you can getLoginUrl() in php and store it in the page (javascript var / data- attribute, etc.) and then call window.open at the right time to open the login url in a popup.

However, you can't just open a popup whenever you want --you'll get blocked. So you'll need to add a "login" link for the user to click on, and an event handler for that click that will open the popup.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文