Fast Apex and Force.com Developer Tips

Menu

Apex Tip: Simplest way to detect Salesforce 1

If you are working to adapt or create a Visualforce page forSalesforce 1, you would know that you need to detect what type of client application (mobile or desktop) is doing the request.

You would need that in order to avoid certain apex:tags that are not compatible with Salesforce1, to change the layout and look and feel and code some special lines like replace links by sforce.one.navigateToSObject(objectId);

After some research I’ve found those nice methods to detect what type of client is requesting the page