I've implemented custom URLs in my app, and they work fine. I've also implemented custom landing pages that show different videos based on a query parameter.
1) I would like to generate links for Twitter, email, etc. that launch my app if the user clicks on a link on a mobile phone. If the user does not have the app installed, it should go to the landing page in the mobile browser. The link should go to the landing page if clicked on major desktop browsers.
2) On the landing page, I would like to have a link to open up the app. If the app isn't installed, the link should open the app store listing.
On StackExchange and Google, I've found these proposed solutions:
A) http://mobify.me/static/tests/test-app-link.html
B) http://aawaara.com/post/74543339755/smallest-piece-of-code-thats-going-to-change-the
These solutions are for part 2) above. However, even the canonical version like A) still generates a "cannot open" error in Mobile Safari before redirecting.
Can anyone tell how to write a redirect service for 1) above?
I'd also love a pointer to a good example of how to handle 2) without a error alert box.
You question is fairly long but I am pretty sure this link is what you are looking for: http://support.mobileapptracking.com/entries/25539969-How-to-Deeplink-to-Your-Mobile-App-from-Your-Website
We used the concepts to create something similar to what you are looking to do.
OK, my friend and former CTO gave me an awesome pointer. You can use a iframe to check, which is a solid technique. He has an example, which I can confirm works well on mobile safari.
Here is the code and example on github:
https://github.com/hampusohlsson/browser-deeplink
Hope that helps!
Related
I've been searching for the past few hours for this and decided I'd just try asking.
I have a URL that people will visit, it loads a PHP page which checks a database for a specific Facebook link, and then instantly redirects them. I want it to open the app if they have it, otherwise it will go to the browser version.
The issue I'm facing is that I can't get the Facebook app to open when it's a redirect. If I instead create a button or a link and I tap on it, it will launch the app correctly, but navigating to that same link without the user interaction will not work.
I know it's possible because I've seen it done elsewhere, but I guess there is something I'm missing.
I've tried using headers("Location: fb://profile/username") and have also tried other Javascript options such as window.open, window.location, window.location.href and window.location.replace
So far I've only tested this an on android phone. The link initially launches in the chrome app.
If you have a look at this Youtube video, you'll see it's doing what I want to do. It goes to a website and then straight away launches the app.
https://youtu.be/Acl7JnRFxzI?t=17
Thanks!
I think you talked about Deep linking.
Deep linking is not supported on Web so there aren’t the same functionalities as on Android and iOS. You still need to guide your users in the right direction, so we recommend adding a link to your login page.
One of my sites has a custom share plugin that I've written and I would like to try to get the 'sharing' feature to open up in the native Facebook app if possible. I know that you can use fb:// to open up the app but from what I've read, this is part of FBML which has been deprecated for several years. What I ideally would like is to have the link open up the FB app with a pre-populated link in the share box that the user could then just automatically share. Basically the functionality of the sharer.php script (it's ok if it pulls the data from the OG tags).
I know it can be done in iOS apps (and probably Android) but is it possible to do through a web interface?
I have the links I'm using only showing on mobile devices through some Javascript so I wouldn't have to worry about it causing any problems sitewide.
Thanks for your help!
var url = encodeURIComponent('http://example.org/');
window.open(
'https://www.facebook.com/sharer/sharer.php?u='+url,
'Share on Facebook',
'menubar=no,toolbar=no,resizable=yes,scrollbars=yes,height=600,width=600'
);
That's the simplest way I do it ;)
I'm currently developing an app that is essentially a single WebView that allows access to a specific website (terrible idea I know, but the decision comes from higher up); said website offers the option to login through Facebook with the standard Facebook Connect procedure.
The login process works fine in Mobile Safari but unfortunately when a UIWebView attempts to do the same thing after authorizing a blank page is displayed and nothing happens. This is of course because of the page actually being just a JavaScript that communicates with the original page through postMessage (I think!).
I tried searching and while this is a pretty widely recognized problem all the solutions I found are either not applicable or won't work. I found somewhere that it's possible to pass mode=redirect to the oauth URL to prevent the whole process to involve popups which sounds promising but as far as I tell it doesn't work.
Is there a way to make Facebook Connect work for a website inside a UIWebView? I'm considering the option of having the Facebook button call a special URL that I would then listen to inside the ap to trigger a native authentication process but unfortunately since my company is not the one developing the website so this kind of solution would be the least preferred.
I have a site that will redirect users to a mobile version of the site if they're browsing on a mobile device. The redirect works fine, but the problem comes when getting them to switch to the desktop version of the site.
If you visit site.com on your mobile, you'll be redirected to m.site2.com (as the mobile version is hosted on a seperate website - confusing I know but it's had to be done this way). Then if the user clicks 'View full site' on m.site2.com, they'll be sent to site.com, but then immediately sent back to m.site2.com.
Is there some code I can put somewhere that specifies if the visitor has come from m.site2.com then it will override the redirect?
This loop is driving me crazy. Also, it has to be in Javascript. If anybody could provide a full script for this I'd really appreciate it!
Thanks
Perhaps setting a query var, or header data can solve Your problem. Checking the referrer can also help.
It's always better to redirect to mobile from the server itself. In your case, you are redirecting from the client side, using JavaScript, right?
I have two solutions.
ONE: disable automatic redirecting. You can provide a "Desktop Site" link on your mobile version and "Mobile Site" link on your desktop version. If users like, then they can choose mobile or desktop.
TWO: create two identical HTML files in your Desktop Site server. Say index.html and index2.html. The difference is, index2.html doesn't have the redirecting Javascript code.
Now redirect the people from the Mobile Version to index2.html at your Desktop Site.
That is, in solution TWO, the flow can be like this:
User → Desktop Site (index.html) → Mobile Site → Desktop Site (index2.hml)
Here you can see, the user first comes to the Desktop Site, in index.html and automatically redirected to the Mobile Site. But the user then clicks to see the Desktop Version. There you should provide the link to index2.html, and then the user is not redirected automatically as the script is missing in index2.html
I'm working on an app built in Titanium that has a few "Tweet about this" buttons. Since I can't use the Javascript part of a Tweet button as described in Twitter API, I just use a plain URL with parameters.
On Android, this causes problems. When users click this link, they get a choice how to open it: always the native browser, and additionally any app that has registered for this kind of link. So if the user has the Twitter app installed, Twitter will be shown as one of the options.
That would be great, except the Twitter app is awful. Most types of suggest-a-tweet URL cause the app to crash, and the few that do work don't pass the status text.
I'm looking for a way to force the URL to be opened by the native browser. (Or way to prevent the Twitter app from being among the options presented to the user, but that seems harder to do)
Is this possible using only the URL itself, or maybe a little Javascript? Since I'm using Titanium, Java won't help me.
I can't give you what you want but give you an alternative suggestion.
What you are trying is hard (often impossible to do without errors) even with native code as your trying to work against the OS. Intents are used in android as a way to let the user decide which program should handle a certain request. If you don't want the user to take this decision I'd suggest opening the url in a embedded browser.