4

I have designed my VisualForce page for Mobile devices(IPhone/Android) as well as IPAD. This is working perfectly on mobile devices(Iphone/Android) via native SF1 app, mobile browser and IPAD Browser.

The issue is When I am opening the same page via SF1 native app from IPAD( iOS 7.1) instead of IPAD View its showing the Mobile view . But the same IPAD view is working fine When I am checking it via IPAD browser (Web link and with one/one.app).

Is there any separate way to differentiate the IPhone/Ipad in SF1 app?

The Way I am doing is by checking User-agent from Server end:

String userAgent = System.currentPageReference().getHeaders().get('User-Agent');
if (userAgent.contains('iPhone')){
     }
    else if (userAgent.contains('iPad')){
    }  //added comment to allow code formatting

Please help.

1 Answer 1

1

There is nothing baked into the JavaScript sforce library that would help you. The only solution is the user-agent check that you are performing.

2
  • 1
    I found the issue here. After debugging the value of userAgent I found that while user is in Salesforce1 native app the value of user-agent changed. For IPAD app user-agent string consist of both "iPhone" and "iPad" along with "Salesforce1". So I need to manipulate my code accordingly. Sep 19, 2014 at 6:02
  • @GirishThakur Did you add a user-agent check for S1 in your code? something like this? return userAgent.contains('Salesforce1')
    – Daft
    Nov 25, 2014 at 11:37

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .