javascript – Can not open facebook page in the app from a link in iOS browser

0
100

[ad_1]

I’m trying to open the facebook app to a certain page with an NFC or QR Code. This works perfectly on the Android, but on iOS I can not for the life of me get the link to behave properly. My code as it stands:

var userAgent = navigator.userAgent || navigator.vendor || window.opera;
var isAndroid = (/android/i.test(userAgent));
var isIOS = (/iPad|iPhone|iPod/.test(userAgent) && !window.MSStream);
var isDesktop = !isAndroid && !isIOS;
var pageName="stubque.springfield";
var page_url="https://www.facebook.com/"+pageName;
var isFocused = true;

setTimeout(() => {
    if(isDesktop) this.location=page_url;
    if(isAndroid) fburl = "fb://facewebmodal/f?href="+encodeURI(page_url);
    if(isIOS){
        //opens facebook, but not page
        fburl = "fb://faceweb/f?href="+encodeURI(page_url);
        fburl = "fb://"+pageName;
        fburl = "fb://page/"+pageName;
        fburl = "fb://facewebmodal/f?href="+encodeURI(page_url);
        fburl = "fb://profile/"+pageName;

        //opens facebook but stuck on loading screen
        fburl = "fb://page?id="+pageName;
    }
    addEventListener('blur', (event) => { isFocused = false; });
    setTimeout(() => {
        if(isFocused) this.location = page_url;
    }, 100);
    this.location=fburl;
}, 1800);

Has anyone had any luck using URL Schemes to open a page in-app on facebook?

[ad_2]