FIX: Detect `window.opener`

This commit is contained in:
Robin Ward 2016-06-09 14:51:38 -04:00
parent c3ad0f447a
commit 4730c82b3a
1 changed files with 3 additions and 1 deletions

View File

@ -22,7 +22,9 @@
<p><%=t "login.close_window" %></p>
<script type="text/javascript">
window.opener.Discourse.authenticationComplete(<%=@auth_result.to_client_hash.to_json.html_safe%>);
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;