I have a Visualforce page that is used in both Salesforce1 and the desktop. On that page is a button. That button should only display if the user is loading the page on the desktop. It should be hidden on Salesforce1. Any suggestions?
Essentially I am just looking for a way to detect if the Visualforce page is loaded in Salesforce1 or not. I can handle the logic of displaying the button, I just don’t know if it is possible to tell if it is Salesforce1 or not.
User.UIThemeDisplayedglobal variables and the
UserInfo.getUiThemeDisplayed()Apex utility methods are improved to support the Salesforce1 mobile app and Lightning Experience.
These existing variables and system calls have expanded the range of return values to support the new user experience contexts. Possible return values include the following.
Theme1—Obsolete Salesforce theme
Theme2—Salesforce Classic 2005 user interface theme
Theme3—Salesforce Classic 2010 user interface theme
Theme4d—Modern “Lightning Experience” Salesforce theme
Theme4t—Salesforce1 mobile Salesforce theme
PortalDefault—Salesforce Customer Portal theme
Webstore—Salesforce AppExchange theme