I am using firebase dynamic links to link my website to my app. I use the longer link (https://example.com/deeplink/?link=example.com/foo?id=1&apn=com.examle.app) so that I can pass parameters into my app through the link. I want to keep this shorter, so I have a website (https://example.com/getfoo?id=1) which sees if the user is on android, and if they are it'll redirect them to the deep link. But it is not redirecting. I am sure it gets the id, and I'm sure it knows whether or not they are on mobile.
I have tried changing the redirect to other pages, and my own website, and it works. But when I try to redirect to my dynamic link, it just doesn't redirect at all. It acts like the redirect doesn't exist.
Code: (hosted on /foo)
const ID = getParameter('id');
if(isMobile()) {
var confirm = confirm("You are on mobile. Would you like to open this page in the app?");
if(confirm) {
var dynamicLink = "https://example.org/deeplink/?link=https://example.org/foo?id=" + prayerID +"&apn=org.example.app"
window.location.replace(dynamicLink);
}
}
When you press OK it should redirect you to the dynamic link which should open the app. Instead on mobile it just leaves you on the /foo webpage. What am I doing wrong?