Understanding WebViews

It’s a way of signifying that Kirupa’s going to cover the basics of webviews in that paragraph.

1 Like

Nice article :partying_face::partying_face::partying_face:.
But I am kinda confused on how webViews are integrated into sections native mobile applications or desktop applications. I know about full screen hybrid apps. I have used electron for creating dektop application. But I don’t know how to embed into a section of the native application like an advertisement.

Hi @Japan1 - welcome to the forums :slight_smile:

Think of the WebView as an image element in your native UI. This image element is part of other things on the page like text elements, buttons, etc. The source of the image element would typically be an image file - which could be a part of the package or retrieved from a remote URL.

Now, replace the image element with a WebView. The source of the WebView could be some HTML content local in your package or some HTML content out in the larger internet.

Does this help clarify?

:stuck_out_tongue:

Very nicely explained Kirupa ! Awesome !

Thanks! Glad you liked it. It was one of my favorite articles to write :nerd_face:

Hey Kirupa,

Enjoyed the article! It covered a lot that most people don’t go into about why you would want to use a WebView.

One thing you didn’t mention is that hybrid apps aren’t supported on iOS. You can still write a hybrid app, but Apple won’t approve it on the App Store. They updated the Human Interface Guidelines a while back to prohibit apps that are simply repackaged web pages, saying that

“Apps that dynamically provide core features and functionality with web technology like HTML5 are best delivered through Safari, rather than through the curated App Store.”

It’s a bit disappointing, but it’s definitely something people should know before they start working on a hybrid-style iOS app.

Thanks!

@cadehunter - that’s good to know! I wonder what their bar is for repackaged apps, for that is a bit unclear. If I repackage a URL but have about 30 lines of extra JS that calls into system APIs, will that pass app store approval? :nerd_face:

1 Like

Hi there, I just watched your video on WebViews (very helpful. thanks, btw) and had a question about enabling WebViews on Wordpress.

So, basically I have a Wordpress site in which I host content (articles, videos). This site CMS’s is used to manage the content and then display it on my app (through AppMySite native app builder). That said, my question is, would it be possible to somehow enable WebViews on my Wordpress site (via plugin or back end work) so that when people click on a post link they are directed to the site hosting the content instead of an internal page? Similar to what social media sites are doing today and your examples from the video.

The blog or site will be public on mobile only so I’m only using Wordpress because I needed to build the UI in a particular way and use it as CMS.

I appreciate any help on this as I’m not a developer and am trying to figure out the best way to go about this. Thanks so much!

@dan27 - is this is a duplicate of a post you made yesterday? :slight_smile:

webViews are also great to build a UX heavy feature once and embed on all cross platform and for a company which has invested in native and web apps and expects the feature to be the same across all platform.

What are your views on local vs Remote webViews?
Since webViews are powerful and have access to native APIs there is a potential of RCE if we start trusting the remote code via the remote webView approach? is local a better option ?

What are your thoughts on smart vs dumb webViews?
I define smart as webView which does a ton of business logic and have less data bridging with the native vs dumb webView which basically focus on just UX and data is being sent to it from native.

For instance, If my native application has already setup a data channel open with the backend server receiving data notifications and now my webView needs data, so i don’t want to establish a separate websocket connection within a webView wasting client/server resources? is dumb webviews the right approach? What are your opinions around these.