Facebook in-app browser not sharing location - javascript

i have a mobile friendly website which makes use of browser location to give nearby places of interest. Its working fine in all browser but when i try to load it from facebook app (Facebook app makes use of its own in app browser to open links ) it waits infinitely to take locations even though my phone's location in shared.
Can any one help in
How to get location from facebook in app browser.
or
How to by pass fb in app browser to open my link in a browser.
Thanks

Related

Is there a way for Android Chrome to remember Geolocation permission for my page?

I'm working on a web app that requires the user's location to get weather data. It's critical for the purpose of the app, and the location call has to be made basically every time the app is used.
It works fine on Chrome on desktop, but when I try to use my site on Android Chrome it asks for the location permission every time. Is there a way to use the Geolocation API that will remember the permission and not make the user approve it every time?
This is how I'm calling the API, as inline javascript on the page that uses the coordinates.
navigator.geolocation.getCurrentPosition(setCoords);
function setCoords(position) {
// Do stuff to the page
}
It turned out this was happening in a web view when I opened the page from a Facebook message. It remembers the location permission on Android Chrome.

Redirect user from iOS browser to App if installed, or to App Store if not - like Yelp

How can I detect whether the user browsing to my website has installed my app, and redirect to it on the click of a button in the banner like yelp?
I only need help with the detecting and redirecting from the browser. Yelp manages to do it. I tried messing with universal links, but I'm not sure how to detect that the user does not have the app and to then redirect him/her to the app store.
Yelp uses a company called Branch (Full disclosure, I work there). We have some complicated infrastructure that allows us to tell when a particular device has the app installed or not.

how to force links or pages to open outside of facebook inapp browser?

First of all there are few posts already but with satisfactory answers so i am posting the same issue again hoping for the solution
Force links to open outside facebook's inapp browser
Open website link outside of Facebook app
The problem is when the user clicks on a website link posted on facebook clicking on the link will open the site in facebook in app browser. I want to detect that the site was opened in facebook's in app browser and then if so force the site or page to open in external browser. I want this ability because there are many things that dont seem to work in facebook's in app browser. I appreciate any input! Thanks!
This is not something you can (reliably) detect.
Even if you could, I'm pretty sure there's no way to force the site to open in the device's browser, instead of the in-app browser
Here's an answer that worked for me, using Firebase Dynamic Links. It works for Android but not iOS.
I needed this solution so I could upload documents in the messenger in-app browser but couldn't on Android devices.
https://stackoverflow.com/a/56143217/3664100

Can you communicate to a native mobile app from mobile web browser?

I want to find a way to run native mobile app, from a web app on a browser, and communicate the result back to it.
For example, how does Facebook user authentication work on a mobile device? You go to login with Facebook on a website. If on mobile, it opens the native Facebook app to do the authentication, and redirects the user back to the mobile web browser to open some page, post-authentication. Somehow, web browser and native application are able to communicate? Is there also any security risk to this?
One way to do this is as follows:
Use a custom url to launch the app from the website (see link below)
Pass whatever parameters you need to the app (for example a return web site URL in the case of a login authentication type app)
Once the app launches and does it thing, have the app launch a browser using the return address URL you passed as a parameter to the app.
A good, well maintained, link to using custom URL's and passing partakers to the App:
http://iosdevelopertips.com/cocoa/launching-your-own-application-via-a-custom-url-scheme.html

How to detect that User has added webapp to the homescreen on mobile device?

I am working on a webapp. I want to count the number of Users that added my webapp to home screen.
suppose my website is.
http://www.example.com
I have added meta tags that allow Mobile users to add it to home screen. I want a count of users that downloaded my webapp. If User has downloaded even if he has not opened that then also I should get notification that User has added it to home screen.
So I need any event that should work when an Webapp is added to home screen.
My webapp is in HTML5
First of all, officially it's not possible, as per the official FAQ:
How can I detect if the app is running as an installed app?
You can’t, directly.
which is again re-iterated
Best practices
Do not prompt the user to add your app to the homescreen. There is no way to detect if the app is running installed or not.
Source: https://developer.chrome.com/multidevice/android/installtohomescreen
You could do some manual checking of the screen sizes though on page load, as chrome can't go fullscreen by hand, but do not rely on this (though for statistical purposes it might be interesting).
Another clarification which might be useful, the application is not downloaded when it's added to the homescreen. All that happens is that a 'link' will be created to chrome with certain parameters. By design little information is disclosed to developers regarding this process to prevent companies from forcing users to 'install' webapps before they would function.
As of 2018, according to https://developers.google.com/web/fundamentals/app-install-banners/:
To determine if the app was successfully added to the user's home screen after they accepted the prompt, you can listen for the appinstalled event.
window.addEventListener('appinstalled', (evt) => {
app.logEvent('a2hs', 'installed');
});

Categories

Resources