Detect blocked popups

This commit is contained in:
James Barnsley
2017-01-05 21:13:37 +13:00
parent 7e2547cea7
commit 99f706cb9d
2 changed files with 15 additions and 9 deletions

View File

@ -29,12 +29,14 @@ class SpotifyAuthenticationFrame extends React.Component{
// listen for incoming messages from the authorization iframe
// this is triggered when authentication is granted from the popup
window.addEventListener('message', function(event){
if(event.data == 'closed'){
self.setState({
frameUrl: '//jamesbarnsley.co.nz/auth.php?action=frame',
authorizing: false
})
}else if(event.data == 'blocked'){
self.props.uiActions.createNotification('Popup blocked. Please allow popups and try again.','bad')
}else{
// only allow incoming data from our authorized authenticator proxy
@ -59,7 +61,6 @@ class SpotifyAuthenticationFrame extends React.Component{
frameUrl: '//jamesbarnsley.co.nz/auth.php?action=authorize&app='+location.protocol+'//'+window.location.host,
authorizing: true
})
this.props.uiActions.createNotification('No popup? Your browser may have blocked it...')
}
renderAuthorizeButton(){