Search code examples
javaandroidhtmljavafxgluon

Is it possible to load a webpage in Gluon Mobile Application?


I'm a student and currently learning + working to develop mobile applications using JavaFX, gluon mobile Application. I'm able to build up distinct applications. But, I wanted to know if there is any possible way to open up a webpage in gluon mobile application. Like we can have it in android by android-studio. But I want to make it in gluon mobile app.

I have checked many of the samples, but none actually helped.

I want this because I have a website which has a mobile responsive theme. Instead of developing a separate app for that ( which is, of course, a very lengthy process), I want the webpage URL to open in-app. So that it will be more easy for me to set up rest of the things...

I have tried the rest, gluon connect settings etc. I have read the docs as well. But couldn't find anything related to that. Or maybe I've missed.. I'll be glad to get support regarding this question.

Any possible help will be appreciated.


Solution

  • Well, as answered in comments by Jose Pereda,

    the WebView worked very well!

    Sample Code:

    //javafx class
    ...
    
    WebView myWebView = new WebView();
    WebEngine web = myWebView.getEngine();
    web.load("https://yoururl.com");
    
    ....
    

    docs can be found here: WebView Javafx Docs