Solved

Processing message while the FB login window is opened.

Posted on 2014-01-19
8
414 Views
Last Modified: 2014-02-26
Hi,

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>

Open in new window

0
Comment
Question by:Rocking
  • 3
  • 3
8 Comments
 
LVL 39

Expert Comment

by:gdemaria
ID: 39802955
If you'd like to display a message saying "processing" while you have an action going on, here is one way..

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.
0
 

Accepted Solution

by:
Rocking earned 0 total points
ID: 39803657
But the problem is how to identify the pop up window (fb login) is opened and now i should hide the div?

I am unable to find the event on which i can hide the div?
Please suggest...
0
 
LVL 39

Expert Comment

by:gdemaria
ID: 39803853
The div would look like this..   the ID tag would be the way you identify it in your code

<div id="procDiv" style="padding:8px;background-color:#cee7ff;text-align:center;">
  Processing...
</div>

Open in new window


Then you show it using this javascript...

document.getElementById('procDiv').display='block';

Open in new window

0
IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

 

Author Comment

by:Rocking
ID: 39805397
@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?
0
 
LVL 39

Expert Comment

by:gdemaria
ID: 39840882
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'
            });
0
 

Author Closing Comment

by:Rocking
ID: 39888260
0

Featured Post

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

JavaScript can be used in a browser to change parts of a webpage dynamically. It begins with the following pattern: If condition W is true, do thing X to target Y after event Z. Below are some tips and tricks to help you get started with JavaScript …
Nothing in an HTTP request can be trusted, including HTTP headers and form data.  A form token is a tool that can be used to guard against request forgeries (CSRF).  This article shows an improved approach to form tokens, making it more difficult to…
The viewer will learn the basics of jQuery, including how to invoke it on a web page. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery.: (CODE)
The viewer will learn the basics of jQuery including how to code hide show and toggles. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery…

706 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

19 Experts available now in Live!

Get 1:1 Help Now