我正在使用 Google+ Javascript API 登录按钮,它在 Windows 和 Android 上的 Chrome 中运行良好。它在 iPad 和 iPhone 上的 Safari 中也能完美运行。但是,在 iPad 或 iPhone 上使用 Chrome 时,Google 登录的弹出选项卡在单击允许访问后永远不会返回。它似乎是将表单提交到弹出选项卡并且从不返回到原始选项卡。有什么想法吗?
最佳答案
Google 知道此问题,但目前对此无能为力。归结为 window.open
在 UIWebview 中不工作。
Safari is not limited by App Store rules the way all third-party apps are. Apple can use any WebKit APIs they want to, whereas we are constrained to what is possible using UIWebView.
他们鼓励遇到此问题的任何人向 Apple 提交错误。
You can't make Apple do anything, but anyone affected by this can file a bug against Apple about the fact that UIWebView doesn't support window.open and subsequent cross-site scripting, to clearly communicate demand for that support.
There's no way for people to add votes or comments to existing Apple bug reports, so the usual advice is for everyone to file their own.
这是 Apple 中错误报告的 URL:https://bugreport.apple.com
这是一个由 one of the users 提供给 Apple 的错误示例:
Summary: Please add support for window.open and subsequent cross-site scripting to UIWebView. This is blocking Facebook/Twitter/etc login workflows in Chrome for iOS for example
Steps to Reproduce: 1. In a tab, open a page that runs the code
var w = window.open(yourURL, null, null); 2. The page at yourURL should try to access
window.opener`, such as to postMessage back to the original page 3. Don't profit.Expected Results: New window can access window.opener.
Actual Results: window.opener is undefined.
Version: 7.0.4
Notes:
Configuration: Chrome Version (from "Settings > About Google Chrome"): 19.0.1084.60 Device Type: iPad 3
可以关注issue thread更新。
关于javascript - Google+ JavaScript API 登录弹出窗口不在 iOS 上返回 Chrome,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/21532693/