Can you prevent another app from opening within your app?

FB.login, prevent launching new window, navigate in current window

  • I'm using this in a mobile app and it would actually be a better user experience if the user navigated away from the app in the same window and then were redirected back. We have the login page redirection back to our app working, but what is the best way to prevent a opening a new window when they click login? This is the method provided by the facebook lib in yummy coffeescript - FF.login = (a, b) -> if FB._oauth throw new Error("OAuth2 specification states that 'perms' " + "should now be called 'scope'. Please update.") if b and b.perms FB.ui FB.copy( method: "permissions.oauth" display: "popup" , b or {}), a else FB.ui FB.copy( method: "permissions.request" display: "popup" , b or {}), a is there an alternative to display: "popup" that will trigger navigation in window? or a param we can pass in? EDIT: I found this in the FB.ui method: "display" must be one of "popup", '+'"dialog", "iframe", "touch", "async", "hidden", or "none"' Do I need to edit the login method directly or can I pass in these display options as params? EDIT2: I guess I could do this? window.location='https://www.facebook.com/login.php?api_key=YOUR_API_KEY&cancel_url=YOUR_ESCAPED_CANCEL_URL&fbconnect=1&next=THE_ESCAPED_URL_TO_RETURN_TO_AFTER_LOGIN&return_session=1&session_version=3&v=1.0&req_perms=ESCAPED_LIST_OF_REQUIRED_PERMISSIONS' Any way to make this work better with the existing FB.login method? Thanks!

  • Answer:

    Actually i dont know fbscript,but i will explain the stuff in simple javascript.Let us assume that <div id="app"> <div id="loginbutton" style="display:block"> <input type="button" value="Login" onclick="changedisplay"/> </div> <div id="loginpage" style="display:none"> <!-- login page stuff goes here --> </div> </div> When the user clicks on login button we can make changes on the CSS display like: function changedisplay(){ document.getElementById('loginbutton').style.display = 'none'; document.getElementById('loginpage').style.display = 'block'; } In the above function you can add jquery fadein or fadeout stuff for look and feel.So, hope this will help you.

fancy at Stack Overflow Visit the source

Was this solution helpful to you?

Other answers

FaceBook has updated the Keyword "Perms" to "Scope" while migrating to OAuth2.0, please change the keyword "Perms" to "Scope" *Old Code : // }, { perms: 'read_stream,publish_stream,offline_access' }); New Code: }, { scope: 'read_stream,publish_stream,offline_access' });* Just comment or remove old Perms to Scope.

bhuvan

Yogesh Narayanan

Just Added Q & A:

Find solution

For every problem there is a solution! Proved by Solucija.

  • Got an issue and looking for advice?

  • Ask Solucija to search every corner of the Web for help.

  • Get workable solutions and helpful tips in a moment.

Just ask Solucija about an issue you face and immediately get a list of ready solutions, answers and tips from other Internet users. We always provide the most suitable and complete answer to your question at the top, along with a few good alternatives below.