{"id":15160717,"url":"https://github.com/willnode/webviewhook","last_synced_at":"2025-09-30T12:30:47.977Z","repository":{"id":122911904,"uuid":"118603934","full_name":"willnode/WebViewHook","owner":"willnode","description":"Exposed Unity Editor WebView API","archived":true,"fork":false,"pushed_at":"2020-12-21T14:53:48.000Z","size":365,"stargazers_count":117,"open_issues_count":5,"forks_count":17,"subscribers_count":8,"default_branch":"master","last_synced_at":"2024-11-10T21:40:08.232Z","etag":null,"topics":["cef","chrome","experimental","unity","unity-editor"],"latest_commit_sha":null,"homepage":null,"language":"C#","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/willnode.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null}},"created_at":"2018-01-23T11:54:41.000Z","updated_at":"2024-08-02T19:01:04.000Z","dependencies_parsed_at":null,"dependency_job_id":"7ed27073-05a5-49d5-ba12-b1d7f6520c88","html_url":"https://github.com/willnode/WebViewHook","commit_stats":null,"previous_names":[],"tags_count":3,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/willnode%2FWebViewHook","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/willnode%2FWebViewHook/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/willnode%2FWebViewHook/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/willnode%2FWebViewHook/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/willnode","download_url":"https://codeload.github.com/willnode/WebViewHook/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":234737799,"owners_count":18879179,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["cef","chrome","experimental","unity","unity-editor"],"created_at":"2024-09-26T23:21:18.094Z","updated_at":"2025-09-30T12:30:42.652Z","avatar_url":"https://github.com/willnode.png","language":"C#","readme":"# WebViewHook\n\n\u003e Warning: WebViewHook is obsolete for Unity 2020 and Above due to removal of Asset Store Browsing in Unity Editor. This project is soon to be archived.\n\nThis is a code snippet to access a hidden `WebView` API from Unity Editor, and load it to `EditorWindow`.\n\n![Screenshot](Screenshots/Demo.png)\n\n## Code\n\nDownload [WebViewHook](Assets/Editor/WebViewHook.cs). See usage example in [WebWindow](Assets/Editor/WebWindow.cs) or [WebEditor](Assets/Editor/WebEditor.cs). You may download the whole project if necessary.\n\n## Usage\n\nMinimum code to get WebView working:\n\n```c#\nclass WebViewDemo : EditorWindow\n{\n\n    WebViewHook webView;\n\n    void OnEnable()\n    {\n        if (!webView)\n        {\n            // create webView\n            webView = CreateInstance\u003cWebViewHook\u003e();\n        }\n    }\n\n    public void OnBecameInvisible()\n    {\n        if (webView)\n        {\n            // signal the browser to unhook\n            webView.Detach();\n        }\n    }\n\n    void OnDestroy()\n    {\n        //Destroy web view\n        DestroyImmediate(webView);\n    }\n\n    void OnGUI()\n    {\n        // hook to this window\n        if (webView.Hook(this))\n            // do the first thing to do\n            webView.LoadURL(\"https://google.com\");\n\n        if (ev.type == EventType.Repaint)\n        {\n            // keep the browser aware with resize\n            webView.OnGUI(new Rect(Vector2.zero, this.position.size));\n        }\n    }\n}\n```\n\n## Two Way Communication\n\nUsing `LoadURL`, `LoadHTML` and `ExecuteJavascript` you only can send information to WebView.\n\nTo extract informations from WebView you need external communication, and the easiest way to do this is by using [Web Socket](https://developer.mozilla.org/en-US/docs/Web/API/WebSockets_API).\n\nTo get web socket server running you need to download [WebSocket-Sharp](https://github.com/sta/websocket-sharp) and a [script utility from this repo](Assets/Editor/WebSocketHook.cs).\n\nSee [WebData](Assets/Editor/WebData.cs) for minimal working example of using `WebSocketHook` to hook C# into javascript variable.\n\n## More Information and Caveats\n\n**This is an editor only solution.** If you're looking to add WebView to a game build then this is not the repo you're looking for.\n\nThe technology behind `WebView` is [Chrome Embedded Framework](https://en.wikipedia.org/wiki/Chromium_Embedded_Framework), [version 37](https://twitter.com/willnode/status/955079655630913541). In Windows it's contained inside the gigantic `libcef.dll`.\n\n`WebView` in Unity is just like Chrome, with background-color default to darkgrey and no plugins (Flash/Java/PDF) allowed.\n\nI solving bugs as I can, but of course limited. If you can't open a specific website, mostly comes down to the fact that Unity haven't upgrade their CEF browser.\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwillnode%2Fwebviewhook","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fwillnode%2Fwebviewhook","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwillnode%2Fwebviewhook/lists"}