Device Detection With Devicedetect.js In Salesforce

Device Detection With Devicedetect.js In Salesforce

A good responsive design in UI can render behaviour across different screen sizes. Though there are few edge cases in Salesforce development, especially where you want to redirect traffic to a mobile-specific page, detect the device and even detect Salesforce1 Application itself.

You can probably do this with the help of a library known as DeviceDetect.js Inspired by isMobile.js. Upload it as a static Resource and then refer it in your Visualforce Page.<apex:includeScript value="{!URLFOR($Resource.DeviceDetect, '/js/deviceDetect.min.js')}" />

1.)  Opened in Phone Check:

1

2.) Opened in Tablet Check:

2

3.) Opened in Desktop Device Check:

3

4.) Opened in Salesforce1 Check:

4

Call the methods as shown below to detect devices and context:

Screenshot from 2018-01-30 18:41:14

“What are your super powers again? – I can Detect Devices" 

31163A0400000578-3442108-image-a-27_1455189872679

Popular Salesforce Blogs