can I detect a user on Mobile Safari (iphone) VS UIWebView (WebKit) with javascript? -
i'd able tell difference between user hitting website on normal safari included in iphone or ipad, vs user hitting same content through uiwebview within native ios app.
i hoping there'd way javascript , user-agent strings? point in right direction further investigation appreciated!
thanks!
i suggest send variable in url string in native ios app , save value session variable on webserver. use session variable things different mobile safari , uiwebview
in ios app when request site add variable
ios
nsstring *urlquerystring = @"?browsertype=iosnative"; nsstring *urlpath = [nsstring stringwithformat:@"http://www.yoursite.com/%@",urlquerystring ]; nsurl *requesturl = [nsurl urlwithstring:urlpath]; nsurlrequest *request = [nsurlrequest requestwithurl:requesturl]; [self.webview loadrequest:request];
php
if(isset($_request['browsertype'])) { //used tracking ios native app user. //this not set mobile browser user $browsertype = filter_var($_request['browsertype'], filter_sanitize_string); $_session['browsertype']=$browsertype; } if ($_session['browsertype']=="iosnative") { echo 'this native app , shouldn't display on mobile page'; }