Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people, just like you, are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
Solved

Processing message while the FB login window is opened.

Posted on 2014-01-19
8
420 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
Master Your Team's Linux and Cloud Stack

Come see why top tech companies like Mailchimp and Media Temple use Linux Academy to build their employee training programs.

 

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

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
key press alert 2 32
Bootstrap date picker V2 date restriction 6 29
Javascript 2 20
what is the best Integrated development environment 2 19
How to build a simple, quick and effective accordion menu using just 15 lines of jQuery and 2 css classes
Today, the web development industry is booming, and many people consider it to be their vocation. The question you may be asking yourself is – how do I become a web developer?
The viewer will learn how to dynamically set the form action using jQuery.
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)

809 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