A technique for adding functionality to native apps is to use web views that display browser content. Here are some of the pros and cons of doing that.
Pros of web views
TLDR; cheaper implementation, easier styling, and easier to release changes.
- Layout can be changed without a release of the app.
- Good for content-heavy views and styled content that changes regularly, e.g., articles. Web views let you leverage css, which is a good tool for this job.
- Good for content with element types that are added / changed frequently — e.g., widgets within articles
- You don’t need to make three versions of the same view (i.e., web, android, iOS — but beware of coupling which makes maintenance harder). And it can be a quick win if the web page already exists.
Cons of web views
There’s crossover here with information in the Benefits of Native Apps Over Web Apps content, particularly around performance issues. TLDR; worse user experience, more likely to break, and more expensive to maintain.
- Can have slow load times, and the page might jump around while loading in.
- Can feel laggy to use.
- Web views might not work consistently on different versions of Android and / or iOS — e.g., problems with the html used for camera integration on Android.
- Often you actually need three different branches in the web code, i.e.,
if iOS (...) else if android (...) else (...)e.g., to support things like hiding headers and footers inside the native apps.
- Web and mobile are tightly coupled — e.g., rebrands / new features / etc. will be inconsistent if they don’t happen together
- Web changes are harder, need testing in more places and are more likely to break on different platforms because of the need to support more platforms.
- Native interaction is brittle. The app bridge uses
stringsto communicate, so you don’t get compile time errors when things break.
- Interfaces can become complex, e.g., if you need to pass something like auth tokens to web views.
- Anything where the web view communicates with the rest of the app is effectively an external interface.
- Hosting the web view inside the app can be complex. Often you need to intercept user interaction, e.g., by rerouting links to stop users navigating to a different page, etc.
- It’s a different skill set to native development, so it can be more costly to make changes and investigate issues.