A (functional / brittle) Web Browser

Hi!

Months before receiving my Playdate, I dreamed of being able to browse the web on it.

That dream has been... partly satisfied. I'm very happy to present an extraordinarily brittle prototype:

browser-demo
(I'm going from example.com to lite.cnn.com)

Does it work (in the Simulator) and is it real? Yes.

So, what's going on?

After evaluating a number of small browsers thinking that I could compile/run one of them on the Playdate, I decided instead to adapt/piggy back on Browsh. Browsh is a command-line text-based browser -- it runs in your terminal and is quite extremely impressive.

How does it work? Well... Browsh starts a headless Firefox (i.e. a real Firefox browser instance, just with no GUI) and lets it (Firefox) do the complicated html/css/javascript work. Using a custom Chrome extension, Browsh streams the terminal-friendly text content to the terminal... et voilà. (it even works with images... I hope to get there too)

I'm skipping a lot of details. And I added a whole other (unstable) layer on top of everything that Browsh does. It's a true rigmarole.

The Playdate browser should be able to have a cursor (you will be able to click links!) and the crank will 100% allow scrolling. And it'd be great to let anyone download the browser and start using it -- which means that I would have to run some servers that everyone would share. Easy peasy...??

Cheers & more news soon hopefully.

Greg

P.S. I know that it's obvious, but this is also my vote for the SDK to have a real device (non-Simulator) ability to fetch data over http. Please :slight_smile:

8 Likes

Hi Greg,

Thank you very much for sharing this! Sorry if I've missed something, but I thought that there is no way to access to the network via the SDK, so how can you get access to it? Only in simulator (something like using the debug protocol/ communication).

Again, sorry if it's a stupid question.

Regards,

Ben

1 Like

Hey Ben,

There are no bad questions! You're correct, this is a Simulator-only functionality for now, specifically:

playdate.simulator.getURL(url)

There's been hints that this functionality will/should appear in a later SDK i.e. we should all get access to on-device network communication, but that's not public yet.

2 Likes

Do you think that you will publish the code to GitHub at some point?

1 Like

Yes, I intend to!

The majority of the code is really Browsh. My contribution is some glue code which pretends to be the Browsh command-line application you typically run in your terminal, and the Playdate Lua app is quite minimal at this point (it fetches the web page as a 2d array of characters and displays them row by row).

Next steps are adding a cursor in the app (to click links) and crank-to-scroll functionality (obviously).

2 Likes