+ Start a Discussion

HTML in login page (login.salesforce.com?display=touch) broken on ios7 uiwebview

The currently served SF login page for touch devices (login.salesforce.com?display=touch) is triggering a really bad UI bug on ios7 webkit view.

Note that this only happens for app that uses their on UIWebView, not iOS7 Safari.


You can reproduce the problem easily. Create a new iOS app that just has a single view, and add a webview to it.

The viewDidLoad method can be as simple as:


- (void)viewDidLoad



    NSString *address = @"https://login.salesforce.com?display=touch";

    NSURL *url = [NSURL URLWithString:address];

    NSURLRequest *request = [NSURLRequest requestWithURL:url];




When you start the app, the login page looks fine. But if you tap on the "User name" field, the UIWebView will fail to set focus.

Tap again, it might shift the page up a few pixels. Tap again, it'll set focus to the password field. Tap again, and you might get foucs finally on the username field. 


This appears to be a bug in ios7. If you have an ios developer forum account, you can read the discussion here:


There are simple test cases on that thread that illustrate the bug. 

There is also a simple workaround for the problem mentioned in that thread:


If the HTML returned from login.salesforce.com change the embedded meta tag from this:


<meta name="viewport" content="initial-scale=1.0; maximum-scale=1.0; user-scalable=0;" />


to this


<meta name="viewport" content="width=device-width, height=device-height, initial-scale=1.0, maximum-scale=1.0, target-densityDpi=device-dpi" />


it will load fine. Verified by serving that page to a UIWebView.


Given that the SF meta tag has a typo in it anyway (semicolons instead of commas), it'd be GREAT if Salesforce could be the "bigger person" here and fix their HTML by adding the few characters here to be compatible with the new ios7 webkit (rather than having to wait for an ios OS upgrade that fixes the issue).


Because logging into SF is often the first step for partner app, this bug looks awful to our users; a fix would be really, realy appreciated.


Looking forward to a response from folks inside SF who can help.







Kevin HawkinsKevin Hawkins
This is a known bug, and we're looking at solutions. The viewport fix isn't sufficient, as it causes significant view rotation issues on iOS 6 apps. I'll post back here when we have the solution ironed out.

Thanks, Kevin. A few more questions:
- are you guys treating this as a SF bug or an Apple one (ie, do you think you'll have a fix without an OS update from Apple?)

- do you have a timeframe for a fix, and is there a tracking id we can reference?

- do you have any suggestions for what we can/should do to mitigate the problem in the interim?


Thanks so much -- this bug really spoils the "getting started" user experience for our app, really appreciate your help getting it fixed.



Kevin HawkinsKevin Hawkins

We have a bug open with Apple, but we're also actively investigating a solution on our end.  I'm afraid I don't have a timeline at this point, except to say that it's being actively pursued.


The only workaround I can recommend at the moment is to build your app with a pre-iOS 7 SDK; the problem does not exist with apps built with the iOS 6 SDK, for example.  This may be an interim solution for you if you're not yet targeting specific iOS 7 features in your app.


I will keep you posted here with any progress made on the bug.


Hi Kevin -


Just wanted to see if you had any update on this one... DF was great but it was painful watching users tap 6 times to get the focus on the login field just to get started. Thanks again for staying on this and any news you have to share. -ck

Kevin HawkinsKevin Hawkins

Fingers crossed, there should be an update this week.

Jeff MenterJeff Menter

We are also anxiously waiting to see if this gets fixed. We use a custom UIWebView to log our users in and running this in iOS 7 is very problematic. As soon as a user taps the username field, the keyboard pops up and is then dismissed. The only workaround is tapping the password field then hitting the < button above the keyboard. That or just targeting iOS 6. Neither is a good solution.

The login screen seems fixed. As of this morning we no longer have this issue on iOS7.0.4