Universal Link through a redirection

We have set up a universal link with our domain lets say example.com(example.com/apple-app-site-association) and If we directly hit the link(with parameters)-

"example.com/redirect-to-Appstore.html?Id=d72203c2-49f2-11e9-8646-d663bd873d93" it works as below:

1. Open up the app and parse the Id in case the app is installed and

2. Redirect to AppStore due to javascript redirect logic in redirect-to-Appstore.html.


The issue is with redirection, our App needs to be triggered by various other domains let's say - "example2.com/index.html", so we are redirecting users to "example.com/redirect-to-Appstore.html?SubId=d72203c2-49f2-11e9-8646-d663bd873d93:2" via JS code(Window.location to be specific) but this doesn’t open up the app even if app is installed, it always redirects to AppStore.


Is there any way to make Universal link works with JS redirection?