javascript Facebook 身份验证对话框:关于使用“显示”类型“弹出”的开发人员警告

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/16542490/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-10-27 05:04:45  来源:igfitidea点击:

Facebook Auth Dialog: Developer warning concerning the use of "display" type "popup"

javascriptfacebookfacebook-javascript-sdkfacebook-php-sdk

提问by Johannes N.

starting today we receive developer warnings in the auth dialog with the following message:

从今天开始,我们在身份验证对话框中收到开发人员警告,其中包含以下消息:

You are using a display type of 'popup' in a large browser window or tab. For a better user experience, show this dialog with our JavaScript SDK without specifying an explicit display type. The SDK will choose the best display type for each environment. Alternatively, set height and width on your window.open() call to properly size this dialog if you have special requirements precluding you from using the SDK. This message is only visible to developers of your application.

您正在大型浏览器窗口或选项卡中使用“弹出”显示类型。为了获得更好的用户体验,请使用我们的 JavaScript SDK 显示此对话框,而无需指定显式显示类型。SDK 将为每个环境选择最佳显示类型。或者,如果您有特殊要求而无法使用 SDK,则在 window.open() 调用上设置高度和宽度以正确调整此对话框的大小。此消息仅对您的应用程序的开发人员可见。

the mentioned warning directly in the popup

直接在弹出窗口中提到的警告

We have the following situation:

我们有以下情况:

  • with javascript we open a new popup
  • the src of the popup is set with Facebook's PHP-SDK method getLoginUrl
  • popup itself has a size of 400px by 580px
  • 使用 javascript 我们打开一个新的弹出窗口
  • 弹出窗口的 src 是使用 Facebook 的 PHP-SDK 方法 getLoginUrl 设置的
  • 弹出窗口本身的大小为 400 像素 x 580 像素

The PHP-SDKitself references the proper use of "display=popup" within it's own code:

PHP-SDK本身引用正确使用“显示弹出=”内它自己的代码:

If you are using the generated URL with a window.open() call in JavaScript, you can pass in display=popup as part of the $params.

如果您在 JavaScript 中通过 window.open() 调用使用生成的 URL,您可以传入 display=popup 作为 $params 的一部分。

The JS-SDK documentationsays, that the maximum-size of the opened popup should be 400x580:

JS-SDK文档说,打开的弹出窗口的最大尺寸应为400x580:

For use in a browser popup no bigger than 400px by 580px. Use this display type to maintain context for the user without needing to perform a full-page redirect.

用于不超过 400 像素 x 580 像素的浏览器弹出窗口。使用此显示类型为用户维护上下文,而无需执行整页重定向。

So, to sum up: According to the docs, the implementation above should be ok. Is anyone else having this warning or a solution for this?

所以,总结一下:根据文档,上面的实现应该没问题。有没有其他人有这个警告或解决方案?

采纳答案by Old Pro

The JS-SDK documentation says the browser popup should be "no bigger than 400px by 580px". What they don't specify is that they mean 400px tall by 580px wide.

JS-SDK 文档说浏览器弹出窗口应该“不大于 400 像素 x 580 像素”。他们没有指定的是他们的意思是 400px 高 x 580px 宽。

I see the developer warning in my popup auth dialogs that are 275 tall by 875 wide. I do not see the warning in my popups that are 400 tall by 580 wide.

我在 275 高 x 875 宽的弹出式身份验证对话框中看到了开发人员警告。我在 400 高 x 580 宽的弹出窗口中没有看到警告。

Your image suggests your popup is 630 high by 446 wide. Too big by any reading of the specification.

您的图片表明您的弹出窗口是 630 高 x 446 宽。任何阅读规范都太大了。

回答by smalu

Maybe you should switch to FB JS SDK and FB.login() method? It always provides the best user experience.

也许你应该切换到 FB JS SDK 和 FB.login() 方法?它始终提供最佳的用户体验。

example

例子

https://developers.facebook.com/docs/reference/javascript/FB.login/

https://developers.facebook.com/docs/reference/javascript/FB.login/