40

Have looked far and wide for info and have found no definitive list. Please add your observations. I'm sure it will come in handy to all.

How2iphone
  • 451
  • 1
  • 5
  • 16
  • Just got stung by this one :: http://stackoverflow.com/questions/3701598/uiwebview-xhmtl-parse-error-but-safari-dont – funkybro Aug 24 '12 at 09:23

7 Answers7

14

It doesn't have the Nitro Javascript engine. This makes executing Javascript much slower in UIWebView compared to Safari.

http://www.tuaw.com/2011/03/18/apple-confirms-some-webkit-optimizations-unavailable-to-ios-apps/

http://ariya.ofilabs.com/2012/06/nitro-javascriptcore-and-jit.html

kioopi
  • 2,170
  • 2
  • 18
  • 26
  • iOS 5 uses the Nitro engine in UIWebView - http://www.theprintlabs.com/with-ios5-the-faster-nitro-javascript-engine-comes-to-the-uiwebview-used-in-html5-magazines/ – Joshua Dance Feb 07 '13 at 22:41
  • @JoshuaDance I'm not quite sure this is true. I think Nitro is used in Mobile Safari and in (finally) websites that are opened with an icon from the homescreen but still not in UIWebView. Updated my Answer with additional link. – kioopi Feb 12 '13 at 13:56
  • makes sense. Sigh, more UIWebView mysteries. – Joshua Dance Feb 18 '13 at 23:30
  • 1
    Are there any known differences regarding how they render pages? Or do they render pages identically? – Behrang May 07 '14 at 12:02
  • 3
    Is this still true for iOS 7 – xpereta May 26 '14 at 16:39
  • This no longer appears to be true, for the newer WKWebView in iOS 8: https://developer.apple.com/library/ios/documentation/WebKit/Reference/WKWebView_Ref/ – Tao Apr 26 '16 at 10:09
11

When UIWebView scrolls its content, it freeze all JavaScript events until the end of scroll. So you absolutely can not programmatically observe and/or control the scrolling process like this common way:

window.onscroll = function() {
    var scrolled = window.pageYOffset || document.documentElement.scrollTop;
    // do something
}

because variable 'scrolled' will be updated only once - after the scroll is completely finished.

HopeNick
  • 244
  • 3
  • 11
  • 1
    This is true of Mobile Safari as well. Not sure about 3rd party browsers, but I imagine it's the same and just a limitation in iOS in general. – theflowersoftime Apr 09 '14 at 22:24
11

One thing I found, to my temporary sorrow is that UIWebView is a bit more strict while setting style values through JS. So say in mobile safari

element.style.width = 300; 

will work just fine, but in UIWebView you must set the value as

element.style.width = 300 + "px";

There are other differences which I'm discovering slowly. I'll update this as I do.

DarthJDG
  • 16,511
  • 11
  • 49
  • 56
SpeedySan
  • 572
  • 4
  • 10
8

You can set the initial max size for HTML5 SQL in Mobile Safari to 50MB, but UIWebView seems to be limited to 5MB. It refuses anything higher.

SKFox
  • 1,377
  • 10
  • 16
  • 1
    This no longer seems to be the case. I work on a packaged app target to iOS 6 and 7, and use a 50MB web sql database without complaint. – Johann Jan 30 '14 at 23:29
3

Two obvious ones I have come across are authentication and pages with frames.

For authentication, UIWebView does not handle authentication challenges automatically, it's up to the developers to handle them.

For pages with framesets, UIWebView does not keep track of the browsing history for page transitinos within frames, which may be a desirable feature. It needs a bit of fiddling to accomplish this.

William Niu
  • 15,798
  • 7
  • 53
  • 93
1

When it comes to performance this is the best summary you are likely to find: http://www.guypo.com/mobile/ios-browsers-speed-bakeoff/

nurieta
  • 1,615
  • 15
  • 6
-5

The main differences are the address/search bar attached to the top of the page and the User Agent.

(note: there are plenty of others, but these are the few that usually matter)

rpetrich
  • 32,196
  • 6
  • 66
  • 89