objective c - How to detect php web page is running within my iPhone App other than Safari -


i have built iphone app(not ipad) , running webpage within web view controller. question how can php file detect being run within app's uiwebview controller not safari. want php page react differently(i.e. rid of html menu) if run within app safari mobile web browser. possible?

webview controller

#import "accountviewcontroller.h"  @interface accountviewcontroller ()  @end  @implementation accountviewcontroller  - (id)initwithnibname:(nsstring *)nibnameornil bundle:(nsbundle *)nibbundleornil {     self = [super initwithnibname:nibnameornil bundle:nibbundleornil];     if (self) {         // custom initialization     }     return self; }  - (void)viewdidappear:(bool)animated {     [super viewdidload];     nsurl *url = [nsurl fileurlwithpath:[[nsbundle mainbundle]pathforresource:@"account" oftype:@"html"]isdirectory:no];     nsurlrequest *requestobj = [nsurlrequest requestwithurl:url];     [_accountwebview loadrequest:requestobj]; }  -(void)webviewdidfinishload:(uiwebview *)webview {     nshttpcookiestorage *sharedhttpcookiestorage = [nshttpcookiestorage sharedhttpcookiestorage];     nsarray *cookies = [sharedhttpcookiestorage cookiesforurl:[nsurl urlwithstring:@"http://www.uniitee.com"]];     nsenumerator *enumerator = [cookies objectenumerator];     nshttpcookie *cookie;     while (cookie = [enumerator nextobject]) {         nslog(@"cookie{name: %@, value: %@}", [cookie name], [cookie value]);     } }  - (void)didreceivememorywarning {     [super didreceivememorywarning];     // dispose of resources can recreated. }  @end 

php file

<?php require_once('connections/uniitee.php');   $iphone = strpos($_server['http_user_agent'],"iphone"); $android = strpos($_server['http_user_agent'],"android"); $palmpre = strpos($_server['http_user_agent'],"webos"); $berry = strpos($_server['http_user_agent'],"blackberry"); $ipod = strpos($_server['http_user_agent'],"ipod");  if ($iphone || $android || $palmpre || $ipod || $berry == true)  {     header('location: login-m.php'); }  ?> 

you load different url parameter in app, such ?appview=true, , in php use if($_get['appview']).

you set session app view true use throughout users session


Comments

Popular posts from this blog

linux - Does gcc have any options to add version info in ELF binary file? -

android - send complex objects as post php java -

charts - What graph/dashboard product is facebook using in Dashboard: PUE & WUE -