I found the following method for S1 server side detection on github:
//Determin if this is SF1 app
public static Boolean isSF1(){
if(!Utils.checkNullOrBlank(ApexPages.currentPage().getParameters().get('sfdcIFrameHost')) ||
!Utils.checkNullOrBlank(ApexPages.currentPage().getParameters().get('sfdcIFrameOrigin')) ||
ApexPages.currentPage().getParameters().get('isdtp') == 'p1' ||
(ApexPages.currentPage().getParameters().get('retURL') != null && ApexPages.currentPage().getParameters().get('retURL').contains('projectone') )
){
return true;
}else{
return false;
}
}
It does the trick and is a very handy piece of code.
However, I can't seem to find any explanation of the parameters it's checking:
sfdcIFrameHost
sfdcIFrameOrigin
isdtp
projectone
Does anyone know anything about these parameters?