FIX: On facebook browser, don't close the window but redirect instead

This commit is contained in:
Robin Ward 2016-06-09 14:20:44 -04:00
parent df368ce251
commit eee15dfe7f
1 changed files with 8 additions and 1 deletions

View File

@ -23,7 +23,14 @@
<script type="text/javascript">
window.opener.Discourse.authenticationComplete(<%=@auth_result.to_client_hash.to_json.html_safe%>);
window.close();
// On facebook browser, just redirect and don't close
var ua = navigator.userAgent || navigator.vendor || window.opera;
if ((ua.indexOf("FBAN") > -1) || (ua.indexOf("FBAV") > -1)) {
window.location.href = <%= Discourse.base_url.inspect %>;
} else {
window.close();
}
</script>
</div>
</body>