SimpleSharingButtons icon indicating copy to clipboard operation
SimpleSharingButtons copied to clipboard

How to open the native mobile app?

Open danielt69 opened this issue 8 years ago • 2 comments

Hi Stefan,

This is a great tool! but one thing is missing in it....

When I share on a mobile device: instead of opening throw the "URL schemes" (the native app that installed) it opens a web browser ...

For instance, it opens : https://www.facebook.com/sharer/sharer.php?u=http%3A%2F%2Fsimplesharingbuttons.com%2F

instead of: fb://...........?u=http%3A%2F%2Fsimplesharingbuttons.com%2F

Is there a solution for that?

danielt69 avatar Apr 11 '16 06:04 danielt69

@danielt69 Interesting question!

Hmm, I just read through these:

  • http://stackoverflow.com/questions/18739436/how-to-create-a-link-for-all-mobile-devices-that-opens-google-maps-with-a-route
  • http://stackoverflow.com/questions/26178853/how-to-open-facebook-native-app-on-mobile-from-a-href
  • http://stackoverflow.com/questions/25313299/how-to-open-facebook-app-from-browser-directly-to-share-view

I am going to leave this issue open for now, while I'm trying to look into this some more. Thanks for the suggestion!

stefanbohacek avatar Apr 18 '16 02:04 stefanbohacek

Hey @fourtonfish, I found a little workaround for this problem if you want to implement it in your generator:

<a class='btn btn-default' href="https://www.facebook.com/sharer/sharer.php?u=http://www.freebets.co.uk" data-mobilesrc='fb://page/604525276265121'>Smart link</a>

<script>
    $(document).ready(function(){
        $('a.btn').click(function(e){
            e.preventDefault();
            var link = $(e.target).attr('href');
            window.setTimeout(function(){
                window.open(link, "_blank", "toolbar=yes,scrollbars=yes,resizable=yes,top=80,left=15,width=555,height=565");
            }, 50);
            window.location.href = $(e.target).data().mobilesrc;
        })
    })
</script>

You can see here all the links for mobile apps: http://wiki.akosma.com/IPhone_URL_Schemes#Facebook

danielt69 avatar Aug 14 '16 12:08 danielt69