Rocking
asked on
Processing message while the FB login window is opened.
Hi,
I need to show the processing message while the fb login window is opened?
Code is given below
I need to show the processing message while the fb login window is opened?
Code is given below
<script>
window.fbAsyncInit = function() {
FB.init({
appId : 'XXXXXXXXXXXX', // App ID
channelUrl : 'yyyyyyyyyyyyyy', // Channel File
status : true, // check login status
cookie : true, // enable cookies to allow the server to access the session
xfbml : true
// parse XFBML
});
FB.Event.subscribe('auth.authResponseChange', function(response) {
if (response.status === 'connected') {
getFBInfo();
} else if (response.status === 'not_authorized') {
} else {
}
});
FB.login(function(response) {
if (response.authResponse) {
console.log('Welcome! Fetching your information.... ');
} else {
console.log('User cancelled login or did not fully authorize.');
}
}, {
scope : 'email'
});
};
// Load the SDK asynchronously
(function(d){
var js, id = 'facebook-jssdk'; if (d.getElementById(id)) {return;}
js = d.createElement('script'); js.id = id; js.async = true;
[u] [b] js.src = "//connect.facebook.net/es_LA/all.js";[/b][/u]
d.getElementsByTagName('head')[0].appendChild(js);
}(document));
</script>
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
The div would look like this.. the ID tag would be the way you identify it in your code
Then you show it using this javascript...
<div id="procDiv" style="padding:8px;background-color:#cee7ff;text-align:center;">
Processing...
</div>
Then you show it using this javascript...
document.getElementById('procDiv').display='block';
ASKER
@gdemaria
I understand the above code but my problem is different:
i have shown the div -> OK
now the poopup window opens (fb login window),need to stop processing message or hide the div once the window is opened -> OK
Now on which event should i hide the processing image since the login window is of facebook?
I understand the above code but my problem is different:
i have shown the div -> OK
now the poopup window opens (fb login window),need to stop processing message or hide the div once the window is opened -> OK
Now on which event should i hide the processing image since the login window is of facebook?
a little trial and error ...
FB.login(function(response ) {
if (response.authResponse) {
console.log('Welcome! Fetching your information.... ');
----- Perhaps in here -----------
} else {
console.log('User cancelled login or did not fully authorize.');
}
}, {
scope : 'email'
});
FB.login(function(response
if (response.authResponse) {
console.log('Welcome! Fetching your information.... ');
----- Perhaps in here -----------
} else {
console.log('User cancelled login or did not fully authorize.');
}
}, {
scope : 'email'
});
ASKER
I solved it with the help of below link
http://stackoverflow.com/questions/5334977/is-there-a-way-to-detect-if-the-facebook-javascript-sdk-loaded-successfully
http://stackoverflow.com/questions/5334977/is-there-a-way-to-detect-if-the-facebook-javascript-sdk-loaded-successfully
Create a hidden div, format as you'd like with the processing message. When you run the script, the first line of code would be to make that div visible, then the user will see processing while the script runs.
If the page refreshes at the end of the processing, then no need to hide the div. If it does not, then simply hide the div at the end of your code block.