Webview with Javascript

I´ve written some basic little game in HTML, CSS and Javascript. I would like to embbedd it into my App. How can I do that?
If I use the webview component and post my code into the HTML content, it shows the first screen of the game but the game itself doesn´t work - like the javascript stuff doesn´t work.
Any tips how to make it work?


If your HTML code has JavaScript in <script> </script> tags, then it should work with the web view component. Although, it would be much more stable if you could host your game elsewhere and embed it via the component.

The idea of @Kirill_Leventcov is good, but if you are still having problems getting your game to work within a WebView, there may be some issues with how you are integrating the game into the application. Some potential solutions to consider are:

Make sure your HTML, CSS, and JavaScript code is properly linked and written correctly. If there are syntax errors or linking issues, the game may not function properly.

If you are using JavaScript to interact with the game’s DOM (Document Object Model), make sure you are using the correct JavaScript APIs to do so. Some JavaScript APIs may not be available within a WebView, so you may need to use alternatives.

If you are using JavaScript libraries or frameworks to build your game, make sure they are functioning properly within the WebView. Some libraries or frameworks may have issues running in a mobile environment and may require special adjustments to work properly.

If you are having trouble debugging your code, using the browser’s debugging tool may be helpful in seeing what is going on behind the scenes. This will allow you to see any errors and warnings that may be causing problems in the game.

What I did was I deployed a fire base site with the game inside an a-frame. Then I just used the url to the site in a web view, passing the user id as a parameter to the url. Such as ?uid=“(userid), and in the web app it first looks for that param and retrieves player info, so that the player never knows they are even in a web view. That way in the web app you can pass points or whatever.

WebGL, 3d, everything works flawlessly, and if you want to use video ads in game use the frame player library to convert video to json using ffmpeg, and play the audio file separately so that the video (better than video, even video 360, plays inline cuz it’s actually not a video.