Hi , In My new Project i would like to add a web view in a WEBGL build .. is it possible ? i am using unity version 5.5 ... if its possible what all plugins do i need ?
Wait, isn't the point of a web view to... view a web page? And a WebGL build runs on a web page, so... you want to have a web page inside an applet inside a web page?
Uniwebview can be used for mobile platforms. But how can I show a webview in WebGL ? I means to show some web page in a WebGL app.
You can call the external jslib method to open iframe for your perticular website. For example I added this example.jslib in Plugins folder Code (JavaScript): var IframePlugin = { iframeClick: function() { if (!document.getElementById('webview')) { var ifrm = document.createElement("iframe"); ifrm.setAttribute("src", "https://www.someexample.com"); ifrm.setAttribute("id", "webview"); ifrm.style.width = "640px"; ifrm.style.height = "480px"; document.body.appendChild(ifrm); } } }; mergeInto(LibraryManager.library, IframePlugin); and called it from C# script using: Code (CSharp): using System.Collections; using System.Collections.Generic; using UnityEngine; using System.Runtime.InteropServices; public class tempscript : MonoBehaviour { [DllImport("__Internal")] private static extern void iframeClick(); public void OpenWebView() { iframeClick(); } } NOTE: You need to add the UI button with the component EventTrigger and adding OnPointerDown method to call the OpenWebView() method. Also you cannot open some sites which have limitations of access control like google, facebook, yahoo, etc.
I have tested this and it is working. A web-view window opens behind the WebGL window. But, I think we can work on looks by changing the unity template and example.jslib.
This is how it looks: You can also pass link from unity like this: Code (JavaScript): mergeInto(LibraryManager.library, { LoadWebView: function (str) { window.alert(Pointer_stringify(str)); if (!document.getElementById('webview')) { var ifrm = document.createElement("iframe"); ifrm.setAttribute("src",Pointer_stringify(str)); ifrm.setAttribute("id", "webview"); ifrm.style.width = "640px"; ifrm.style.height = "480px"; document.body.appendChild(ifrm); } }, }); Unity Code: Code (CSharp): string url = "https://www.sample.com/"; // Start is called before the first frame update void Start() { LoadWebView(url); } [DllImport("__Internal")] private static extern void LoadWebView(string url); You can see this link for more information:- https://docs.unity3d.com/Manual/webgl-interactingwithbrowserscripting.html