ios - Deep linking an app in PHP is not working -
i have webpage needs check see if app exists using deep link, doesn't seem work should. have tried following things.
- using redirect in php (doesn't work)
header('location: exampleapp://param=test');
using redirect using javascript (doesn't work)
var appurl = 'exampleapp://param=test'; var appstore = 'https://itunes.apple.com/us/app/...'; var timeout; function preventpopup() { cleartimeout(timeout); timeout = null; window.removeeventlistener('pagehide', preventpopup); } function startapp() { window.location = appurl; timeout = settimeout(function(){ if(confirm('you not seem have app installed, want go download now?')){ document.location = appstore; } }, 100); window.addeventlistener('pagehide', preventpopup); } // app start called in onloadsame above replace the line
window.location = appurl;document.getelementbyid('deeplink').click();, adding link in html's webpage. (works)<a id="deeplink" href="exampleapp://param=test">deep link</a>
is there reason why can't redirect using header in php?
the php version doesn't work, because of way http works. http protocol doesn't specify should work redirect different protocol within "location:" header. there nothing specific php here, it's http issue.
the javascript version doesn't work because wanted set windows location. , window cannot show contents of "exampleapp://..." . want link open when user clicks on it. instead of using window.location may use document.location.href. should work.
another problem: in code write exampleapp:// in 1) , 2). , in 3) write testapp:// - make sure use same url in 3 cases, can sure url can work eventually..
Comments
Post a Comment