Uiwebview and Safari Comparison

UIWebView and Safari comparison

Does UIWebView use the same JavaScript engine as Mobile Safari?

UIWebView does not have the Nitro Javascript engine, so it executes JS slower than Mobile Safari. So it's not the same.

Also, does UIWebView support all HTML5 features like Mobile Safari does? I am specifically concerned about Web SQL and Web Workers

Not sure about this one. Probably not. At least UIWebView is a bit more strict than Safari on certain features. Example: when setting a width/height style through JS, you need to add 'px' behind the number, while Mobile Safari does not require that.

If I have an app which is written purely in HTML and JS, should I wrap it up in a UIWebView or should I have it open in Mobile Safari

If you want to release the app on the App Store, you will have to wrap it. If not, you don't really have to.

Are pure HTML and JS apps accepted on the Apple store?

If you wrap it, yes. But it has some limitations, as James Webster wrote.

See this question here on SO for more information on the differences between UIWebView and Safari.

Loading performance between a UIWebView and Safari is considerably different, any pointers?

It is likely because Safari has cached the resources of the site already. A basic UIWebView does not do any caching by itself. You'll have to implement that yourself. See a question about that here:

How to cache content in UIWebView for faster loading later on?

iOS UIWebView not 100% compatible with Safari on iOS?

iOS 4.3 introduced the nitro JS engine to mobile Safari, which uses JIT for increased performance, but for security reasons JIT is disabled for UIWebViews.

My guess would be that UIWebView still runs the pre 4.3 JS engine.

Difference between WKWebView and Safari?

I believe it's just configuration. check out WKPreferences

I guess that if you enable whatever you can, you'll find the requested feature.. I'll check adidas to see if I find something special needed

EDIT:
Second option, you may trick the website that you are a different browser.
just set customUserAgent, see here.

You can see a working example in your Mac.

1) Open Safari

2) Development

3) User Agent

4) Other

Copy and past it to your code, Good luck!

Take for an example the next value:

Mozilla/5.0 (Macintosh; Intel Mac OS X 10_12_6) AppleWebKit/604.3.5
(KHTML, like Gecko) Version/11.0.1 Safari/604.3.5


EDIT: Example for swift 5 and XCode 10.2.1

Thanks Mr.G

testWebView.customUserAgent = "Mozilla/5.0 (iPhone; CPU iPhone OS 12_3_1 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/12.1.1 Mobile/15E148 Safari/604.1"

UIWebView different size from Safari

UIWebView has a property called scalesPageToFit which by default is set to false. If you set this property to true the loaded web content will be scaled to fit into the UIWebView.

webview.scalesPageToFit = true


Related Topics



Leave a reply



Submit