Facebook共享对话框关闭取消而不是重定向?

时间:2015-06-30 16:13:41

标签: javascript facebook

我正在使用此网址:

https://www.facebook.com/dialog/share?app_id=xxx&display=popup&href=' . urlencode($url) . '&redirect_uri=' . urlencode($url)

我使用window.open在弹出窗口中打开它。

理想情况下,当我点击取消时,我只想让弹出窗口关闭..但只有当我确定它是一个弹出窗口时。因此,我认为移动浏览器的行为应该不同?

我该怎么做?

1 个答案:

答案 0 :(得分:0)

The best solution is typically making the redirect_uri go to a page on your server that does a simple JavaScript window.close().

Mobile devices shouldn't be a problem - they open in an new window instead of a popup and window.close() works in the same way. Consider including text saying something like "You may now close this window" in case the user doesn't have JS enabled or window.close() doesn't have permissions for an unusual reason.