# Documentation

<figure><img src="https://3463285128-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FmRKt4CGSxyWYs97naGI6%2Fuploads%2Fc5gYCn88Xy6ybNRMlffR%2Fheader.png?alt=media&#x26;token=28e6bd71-aeb0-42e5-87fc-954743c349c0" alt=""><figcaption></figcaption></figure>

## What is TLabWebView?

`TLabWebView` is a Plug-in to use Android's web browser component ([`WebView`](https://developer.android.com/reference/android/webkit/WebView) / [`GeckoView`](https://mozilla.github.io/geckoview/)) as uGUI (Texture2D). Works on mobile and VR devices (e.g. Oculus Quest). This plugin makes it possible to implement a 3D web browser (3D WebView) within Unity.

{% embed url="<https://www.youtube.com/watch?v=q3swlSP1mRg>" %}
Demonstration using Oculus quest 2 + Oculus Integration
{% endembed %}

{% embed url="<https://www.youtube.com/watch?v=_oWE5RlsHLk>" %}
Demonstration using Oculus quest 2 + Mixed Reality Toolkit
{% endembed %}

## The goal of the development

### Independent of developer tools

`Meta XR SDK`, `XR Interaction Toolkit`, `MRTK`, `VRIF` ...., there are some developer tool for Unity but they are usually based on PointerEvent for uGUI interaction. `TLabWebView`'s touch panel interaction is also developed based on PointerEvent for high compatibility and easy integration with any development tool.

### Supports both OpenGL and Vulkan

This plugin supports both `Vulkan` and `OpenGLES`, but if you are building an application that uses a `Vulkan` graphics API, the Android device must support `OpenGLES (3.1+)` as well as `Vulkan`.

### Supports both WebView and GeckoView for the browser engine

This plugin supports `WebView` and `GeckoView` for the browser engine, but currently the `GeckoView` feature is only developed with version [125.0.20240425211020](https://mvnrepository.com/artifact/org.mozilla.geckoview/geckoview/125.0.20240425211020) and needs API level `33+` for build. `WebView` and `GeckoView` are mostly same, but `WebView` doesn't need to include browser engine library (like `gekoview-*.aar`) in the app, and this is benefit for reduce app size. Also, `WebView` could send message from javascript to Unity CSharp easily, it has benefit for interaction with browser and Unity CSharp. In contrast, `GeckoView` needs to include browser engine library in the app, but more customizability than `WebView` for popup UI event. Currently, uGUI based html5 popup (`select tag`, `datatime-local`, etc ...) are supported only in `GeckoView`.

## How to get it

The source code is available on `GitHub`. Please click on the links below to obtain samples that suit your purpose.

{% embed url="<https://github.com/TLabAltoh/TLabWebView>" %}
Plug-in to use Android WebView as uGUI (Texture2D)
{% endembed %}

{% embed url="<https://github.com/TLabAltoh/TLabWebViewSample>" %}
Sample Unity project to make TLabWebView work on mobile
{% endembed %}

{% embed url="<https://github.com/TLabAltoh/TLabWebViewVR>" %}
Sample Unity project for using TLabWebView in OculusQuest. Includes Meta XR SDK and XR Interaction Toolkit implementation example.
{% endembed %}

{% embed url="<https://github.com/TLabAltoh/TLabWebViewMRTK>" %}
Sample Unity project for using TLabWebView with Mixed Reality Toolkit in OculusQuest
{% endembed %}

{% embed url="<https://github.com/TLabAltoh/TLabWebViewMRTK3>" %}
Sample Unity project for using TLabWebView with MRTK3 in OculusQuest
{% endembed %}

{% embed url="<https://github.com/TLabAltoh/google-cardborad-webview-sample>" %}
Currently, this is a very rough example project. Just display webview on google-cardborad-sample.
{% endembed %}

{% embed url="<https://github.com/TLabAltoh/TLabWebViewPlugin>" %}
Source code of java plugin used in TLabWebView
{% endembed %}

{% embed url="<https://gist.github.com/TLabAltoh/e0512b3367c25d3e1ec28ddbe95da497#file-tlabwebview-snippets-md>" %}

## Donation

TLabWebView is open source and therefore free to use, but donations motivate development.

{% embed url="<https://www.buymeacoffee.com/tlabaltoh>" %}

## Note

Scripting API page removed to maintain integrity between source and document. Currently groping for a way to automatically reflect the original source's xml summary on the gitbook's scripting API page.

## Discussion

[unity-discussions](https://discussions.unity.com/t/tlabwebview-open-source-3d-web-browser-plugin-for-android/1584180)\
[github-issues](https://github.com/TLabAltoh/TLabWebView/issues)
