2

To be succinct, I want to know how android webview works underneath the covers. I've scoured the Internet and cannot find an article or resource which discusses the innerworkings of the webview class. It essentially is an emulator for viewing web pages in the browser, right?

Does that mean it employs a strict client-server relationship, a la the Android browser, or is it more complicated than that?

Is there any reason a web page will display perfectly in the Android browser, yet produce server-side errors when opened from within an Android app, via webview? That is, can webview induce server-side code errors?

Thank you.

user717236
  • 4,799
  • 19
  • 61
  • 98

3 Answers3

2

Your question seems based on a number of misconceptions which others have addressed.

I will instead comment on something which others have overlooked:

While the default Android Browser is based on the same engine as the webview, it is substantially extended in less-than-fully-documented / non-public-api ways and will in fact behave differently. So yes, there are lots of reasons that something would work in the default browser, but not in a webview. A few of these difference may be easily corrected with configuration options to the webview, others are going to be very tricky and you may need to look at the source of alternative browsers to find solutions which are portable across android versions (as the way Browser does it is coupled to the specific version it is built for).

If differences in client behavior would result in an error on the server side depends on what assumptions the server makes about the client, and how robust it is against unexpected client behavior.

Chris Stratton
  • 38,489
  • 6
  • 80
  • 115
1

the best way to think of a webview is that it is the native web browser without the address bar. It will render HTML, CSS, javascript etc. exactly the same way the normal browser would.

I can't see any reason why google would have created a native browser and then ignored that code and not extend it to be the webview in its SDK ?

Simon McLoughlin
  • 7,803
  • 5
  • 32
  • 53
  • Right, thank you. I'm not asking, however, if it's ignoring HTML markup, CSS, et al. I'm trying to determine if it's modeled on a strict client-server relationship. If I have a JSP page with Java code, would the webview process that Java or care about it at all? – user717236 Jun 19 '12 at 14:51
  • 1
    no, again your misunderstanding the concept. it is not modeled on anything, its a web browser plain and simple, it has no address bar, you either give it HTML (or watever) to render and it will or point it to a webpage and it will behave in the same way the mobile browser will, under any set of circumstances. The only difference is the lack of an address bar for a user to type in – Simon McLoughlin Jun 19 '12 at 18:31
  • Thank you. Unfortunately, the question I posed here, http://stackoverflow.com/questions/11052431/android-app-using-webview-induces-jsp-java-error-in-jsp-page-served-by-win-apa, seems to indicate that webview behaves differently than the default Android browser, per Chris Stratton's post. On that question, I am getting server-side errors when using webview. Outside of webview, no errors. It makes no sense that server-side code processed by a JSP engine (i.e. Tomcat) would have an error within webview and no where else. But that is exactly what's happening in my case. TY again for your help. – user717236 Jun 19 '12 at 19:09
1

It essentially is an emulator for viewing web pages in the browser, right?

Only to the extent that any Web browser "is an emulator for viewing web pages in the browser". WebView is the WebKit Web asset retrieval and rendering engine that lies at the heart of Safari, Chrome, etc.

Does that mean it employs a strict client-server relationship, a la the Android browser

The AOSP Android browser, and most browsers for Android other than Opera and Mozilla, use WebView. Hence, the behavior you see from your use of WebView, on the server side, should be generally indistinguishable from other users of WebView.

That is, can webview induce server-side code errors?

No more than any other browser would.

CommonsWare
  • 910,778
  • 176
  • 2,215
  • 2,253