Skip to content

Instantly share code, notes, and snippets.

@tehnrd
Last active June 12, 2017 20:00
Show Gist options
  • Star 3 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save tehnrd/9242970 to your computer and use it in GitHub Desktop.
Save tehnrd/9242970 to your computer and use it in GitHub Desktop.
Check to see if Visualforce page is inside Salesforce1
//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;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment