Facebook Mobile App. Like to continue - javascript

I want to make a mobile app that makes a user like a certain page to continue.
I know that to check if a user has liked a page for a regular app you can make the app a tab of that page, and then use the signed_request to see if the user has like the page.
How would this work in mobile? I have looked to see if you can include a mobile page as a tab, but I couldn't find much information.
Can you include a mobile app as a tab? If not then how would you make a user like a page before entering?
I will be using jquery mobile and javascript for most of the non back end work.

try this
You can subscribe to events . Following event will be raised when some user clicks "Like" button.
FB.Event.subscribe('edge.create', function(response) {
//redirect or perform some action
});
Source : http://developers.facebook.com/docs/reference/javascript/FB.Event.subscribe/

Related

How can I disable deeplinks aka when opening a link, it doesn't redirect to an app but goes to mobile browser

So I am running an ad and I need the potential customer to reach a very specific page. However, when clicking on the ad, it redirects to the mobile app, therefore breaking the path I want the user to take.
Is there a way to add some code that will always direct the user to the mobile browser version rather than the app if they have it installed on their smartphone?
I had a look around but all the solutions find how to bring the person to the app. I want the opposite.
make the link in your ads different from that which you need to open in app
like example.com/add and other links as example.com/* and in regex trying do something like this /^((?!example.com/add).)*$/s

How to launch an android app from website

I have an android application, which I want to launch from the website.
Here is the condition: If user had installed that app previously then give the option to open it, if not then go to the play store.
I used this code in my website:
Click me
It is working fine.
Now what I want that when a user searches my website on Google and the link appears, if someone clicks on that link it will open the app.
As well as this code:
Click me
is not working if I put this into a function like:
launchApp:function(){
$window.location.href='myapp://link';
}
this is not working.
How do I fix these issues?
Create an Intent filter for the main activity/ the activity which you want to open, something like this: https://stackoverflow.com/a/31404717/7527995

Close an activity or go back from withing webview using javascript

I have an android activity with WebView in it. When the activity loads with a page, it has two buttons (in html) one for accept and one for decline.
When the user clicks accept, the application works the way it should.
What I want is when a user clicks the decline button, the application should go to the previous activity. Since this is a webview so it has to be done through javascript. I have already tested running javascript and can execute toast messages from webpage.
I want an exact line which I should write to close the activity, or go back.
Secondly, can I track the URLs which web view is going to, as Once the job of webview is done, and it goes to a specific page, and from there I want to return to my application, how can this be done?
Best way to do that is to make redirect call from your javascript code to the specified url, which will be parsed by your custom WebView, so you will be able to handle this redirect from your WebView code and finish your Activity or something else

Looking to Mimic GMail page change detection behavior

I would like to have my web app be abple to pop open new windows like GMail does for chats and phone calls but I'd also like to be able to detect if they click on something in the nav that will take the main window to another URL and break the code running in the popups windows.
Ideally it would prompt them and give them a chance to cancel the page change and not break the app. Any ideas how GMail does this?
You want to use the onbeforeunload event. The string you return will be displayed to the user in a dialog, giving the user the option of canceling the page navigation.

Facebook Connect Bug - JavaScript Refresh

Facebook Connect has a recent bug that is causing the permissions pop-up window to not close and refresh the parent window as it is designed to do. Instead, after approval by the user it attempts to load the page directly in the pop-up window which is an awful user experience and really hurting our registrations. You can see the bug by registering for our site using Facebook Connect: http://alltrails.com
The URL of the page after the user connects that Facebook Connect is incorrectly loading in the permissions pop-up window is of the form:
http://alltrails.com/?installed=1&session={"session_key":"2.Gu0duOqdElNjXRac5wnetw__.3600.1283799600-1486832834","uid":1486832834,"expires":1283799600,"secret":"tKFaEgBTF9RJeuQZfYUSCw__","base_domain":"alltrails.com","sig":"a8dd9f75418b530ae6c3d935e14274c4"}
I'm hoping that someone much better at JavaScript than myself could suggest a simple code snippet that we could add to our homepage that would only be invoked if the page URL includes '?installed=1' and would do the following to allow the same user experience as Facebook Connect was intended to provide:
Close the permissions pop-up window
Load the appropriate page http://alltrails.com/register/facebook in the original parent window
I've tried to do this a bunch of different ways but haven't had any luck with getting it to work correctly. Thanks in advance for your help!
It's a (unconfirmed) bug.
http://bugs.developers.facebook.net/show_bug.cgi?id=12260
Hopefully it gets more votes so it gets fixed - vote people!
In the meantime, i am (attempting) to employ the following 'creative workaround':
Add logic to my Default.aspx page to detect that URL they are redirecting to in the popup.
Redirect to my page, FacebookInboundAuthorization.aspx, preserving querystring.
On load of that page, register some JavaScript to close the popup and manually fire the "onlogin" event handler for my button.
EDIT - Another possible solution
So i do something like this for the "Disconnect from Facebook" button, which has a similar bug which has been in FBC from day 1. If the user is already logged in, and you click the "Disconnect from Facebook" button, the "onlogin" handler is not fired.
So what i ended up doing is replacing the Facebook Disconnect button with my own regular anchor tag, mimicing the Facebook CSS. This way i can have full control over the click event (fire the function i want).
So, this principle could (theoretically) be applied to this current bug.
That is, after you do FB.Init on client-side:
Check FB auth status using FB.Connect.ifUserConnected
If user is connected, hide the regular FB:Login button, and show your "fake" FB Login button. Copy across the "onlogin" function from your regular FB:Login button to your fake button as the onclick event.
Your Fake FB Login button would be a regular anchor tag, with the same CSS applied to the regular FB Login buton.
So essentially, if the user is already connected, we don't really need FB's intervention for authentication, we can just do whatever we want (request perms, redirect, etc).
That should work.
Unfortunately i have higher priority things i need to work on, but it sounds like this is top priority for you.
So give that a go, hope it helps.

Categories

Resources