Home SALESFORCEAPEX how to check the page is loaded in mobile or browser using Apex Class

how to check the page is loaded in mobile or browser using Apex Class

its achievable with the help of “User-Agent” header properties like below:

 

String userAgent = ApexPages.currentPage().getHeaders().get('User-Agent'); if (userAgent.contains('iPhone')) {     return 'iPhone-Safari'; } else if (userAgent.contains('iPad')) {     return 'iPhone-Safari'; } else if (userAgent.contains('Salesforce')) {     return 'Salesforce'; } else if (userAgent.contains('BlackBerry')) {     return 'BlackBerry'; } else {         return 'other'; }

 

 

You may also like

Leave a Comment

*