Allow redirects on Facebook Browser

This commit is contained in:
Robin Ward 2016-06-09 15:51:46 -04:00
parent f6eb5e823b
commit 171dbd4b09
1 changed files with 5 additions and 8 deletions

View File

@ -22,17 +22,14 @@
<p><%=t "login.close_window" %></p>
<script type="text/javascript">
if (window.opener) {
window.opener.Discourse.authenticationComplete(<%=@auth_result.to_client_hash.to_json.html_safe%>);
}
// 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.html_safe %>';
// } else {
if ((ua.indexOf("FBAN") > -1) || (ua.indexOf("FBAV") > -1)) {
window.location.href = '<%= Discourse.base_url.html_safe %>';
} else {
window.opener.Discourse.authenticationComplete(<%=@auth_result.to_client_hash.to_json.html_safe%>);
window.close();
// }
}
</script>
</div>
</body>