# Embedded browser in processing

**URL:** https://discourse.processing.org/t/embedded-browser-in-processing/19196
**Category:** Processing for Pi
**Created:** [March 30, 2020, 3:58pm UTC](https://discourse.processing.org/t/embedded-browser-in-processing/19196 "2020-03-30T15:58:18Z")
**Posts on this page:** 7
**Page:** 1

<div class="post-metadata">

### Author: ![jcduino](https://avatars.discourse-cdn.com/v4/letter/j/c0e974/32.png) [@jcduino](https://discourse.processing.org/u/jcduino)
#### Post date: [March 30, 2020, 3:58pm UTC](https://discourse.processing.org/t/embedded-browser-in-processing/19196/1 "2020-03-30T15:58:18Z")

</div>

Hi,

I need to put a web browser in a processing sketch. I’m trying with javafx class Webview but with no succes. This is my code for testing.

I need a offline map. I think I can do it with html css js, because I’ve try it with Unfolding maps library, but I only can import mbtiles and my maps are in pbf format and others.

May someone help me please? Another idea?

```auto
import javafx.application.Application;
import javafx.scene.Group;
import javafx.scene.Scene;
import javafx.scene.control.ScrollPane;
import javafx.scene.layout.VBox;
import javafx.scene.web.WebEngine;
import javafx.scene.web.WebView;
import javafx.stage.Stage;

void setup(){
    
    size(800, 480);
    new WebViewer();
}

void draw() {
    //background(0);
}
public class WebViewer extends Application {

    @Override
    public void start(Stage stage) {
        stage.setTitle("HTML");
        stage.setWidth(400);
        stage.setHeight(480);
        Scene scene = new Scene(new Group());

        VBox root = new VBox();     

        final WebView browser = new WebView();
        final WebEngine webEngine = browser.getEngine();

        ScrollPane scrollPane = new ScrollPane();
        scrollPane.setContent(browser);
        webEngine.loadContent("<b>asdf</b>");

        root.getChildren().addAll(scrollPane);
        scene.setRoot(root);

        stage.setScene(scene);
        stage.show();
    }
}

```

Best regards.

---

<div class="post-metadata">

### Author: ![tomjuggler](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/tomjuggler/32/809_2.png) [@tomjuggler](https://discourse.processing.org/u/tomjuggler)
#### Post date: [March 31, 2020, 4:25am UTC](https://discourse.processing.org/t/embedded-browser-in-processing/19196/2 "2020-03-31T04:25:19Z")

</div>

It’s probably not what you are looking for, but have you considered just using a .jpg image of a map instead? Just mentioning this because I did this recently for a sketch where I was considering a map but realized that I didn’t need to use the Zoom or any other function, so why not just an image of a map. I just drew the data on top

My simple sketch for reference: [https://github.com/tomjuggler/parseCoronavirusSA](https://github.com/tomjuggler/parseCoronavirusSA)

---

<div class="post-metadata">

### Author: ![jcduino](https://avatars.discourse-cdn.com/v4/letter/j/c0e974/32.png) [@jcduino](https://discourse.processing.org/u/jcduino)
#### Post date: [April 1, 2020, 6:31pm UTC](https://discourse.processing.org/t/embedded-browser-in-processing/19196/3 "2020-04-01T18:31:27Z")

</div>

I need a moving map, but thank you for the option and reply.

---

<div class="post-metadata">

### Author: ![jeremydouglass](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/jeremydouglass/32/20_2.png) [@jeremydouglass](https://discourse.processing.org/u/jeremydouglass)
#### Post date: [April 4, 2020, 10:55pm UTC](https://discourse.processing.org/t/embedded-browser-in-processing/19196/4 "2020-04-04T22:55:01Z")

</div>

I’ve been down this road a few times, although I don’t remember trying to use WebEngine specifically. My personal experience is that it is usually a bad idea trying to put a browser inside a java sketch. If it all possible, it is better to port your sketch to p5.js – then you get a browser for free, because you are running in one (and can also, for example, use iframe or frames).

What kind of map do you need, with what features? Is it up-to-date data from a provider like Google Maps / etc.? Or is it just a bunch of tiled images that you need to drag around a view, and do you need zooming? If the later, than either UnfoldingMaps or just use Tiled – which is designed for games, but works just fine on any 2d collection of image tiles.

---

<div class="post-metadata">

### Author: ![jcduino](https://avatars.discourse-cdn.com/v4/letter/j/c0e974/32.png) [@jcduino](https://discourse.processing.org/u/jcduino)
#### Post date: [April 6, 2020, 8:40am UTC](https://discourse.processing.org/t/embedded-browser-in-processing/19196/5 "2020-04-06T08:40:04Z")

</div>

I need a offline map of real world for navigation (big uav system) from openstreetmap tiles or other provider, using gps position and may be 3d features like synthetic vision system (I don’t know how to do the svs yet).  
I need a gui for options like unit system, views,…and change the views  
I need to interact with the system, a raspberry pi, to shutdown or restart the system, save some data in the filesystem or update the system, launching a sh file.  
I need to interact with sensors, may be serial or CAN bus.

I think that html-css-js is a good idea but I’ve to learn, this is not a problem, may be more time and I’ll need to re-solve some problems I found before.

Thank you very much for your interest Jeremy.

Best regards.

---

<div class="post-metadata">

### Author: ![jeremydouglass](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/jeremydouglass/32/20_2.png) [@jeremydouglass](https://discourse.processing.org/u/jeremydouglass)
#### Post date: [April 16, 2020, 3:49am UTC](https://discourse.processing.org/t/embedded-browser-in-processing/19196/6 "2020-04-16T03:49:49Z")

</div>

If you haven’t already searched there are a couple raspberrypi aircraft and uav interface projects that have been on the forums lately. They are focused on instrumentation, not mapping, but might be of interest.

See for example

> [@Real-world Instrumentation](https://discourse.processing.org/t/real-world-instrumentation/18939):
>
> An upside of the current epidemic circumstance is finding time to (almost) complete a P3/RaPi/ARM instrumentation system. It’s been put together for non-certified aircraft, specifically my own, that should take flight during this summer (N.Hemisphere). Although all sensor data is sourced and formatted by ARM processors the whole thing comes together through the capability, simplicity, and artistry, of Processing code. This post is to show what a little hacking effort can produce; the images bel…

---

<div class="post-metadata">

### Author: ![jcduino](https://avatars.discourse-cdn.com/v4/letter/j/c0e974/32.png) [@jcduino](https://discourse.processing.org/u/jcduino)
#### Post date: [April 16, 2020, 5:16pm UTC](https://discourse.processing.org/t/embedded-browser-in-processing/19196/7 "2020-04-16T17:16:09Z")

</div>

I’ve been searching about maps…this is a real big world and it seems to be dispersed.  
I think that I can develop my own map server with apache and other componentes and may be I can use unfolding library. There are some tile sets I can use.

Thank you for the example, there are two good projects!

Best regards.
