A single tab web browser built with puppeteer. Also, no client-side JS. Viewport is streamed with MJPEG. For realz.

Overview

🎩 puppetromium npm npm

puppetromium in action

A simple browser UI for puppeteer, built with no client-side JavaScript.

Puppetromium is a single file simple web-browser built on Puppeteer. If Chromium and Puppeteer had a love child, it would be this horrible. Probably.

Also, there is no (as in zero "0") client-side scripting (in this browser UI) of any kind. No JavaScript. No ActionScript. No Flash. This crazy-simple remote browser UI is built entirely with HTML and CSS.

How is this possible?

With the power 💪 , my friend, of the following ancient ®️ techs ©️ from ye olde webbe:

  • MJPEG to stream the remote viewport with server-push only
  • to capture X and Y co-ordinates of pointer events and post them to the server on click.
  • targeted forms and named iframes to allow transmitting actions like 'type text' or 'scroll down' without reloading the top-level page.

but why?

Mostly as an exercise. To see how simple I get a remote browser that is still minimally usable. But also as an example of why puppeteer is not a great fit for this. And a reminder why I created a whole other browser driving protocol atop the DevTools protocol for my custom remote isolated browser.

Also because I thought people will think a browser UI built with Puppeteer is cool, and it might encourage them to get into remote browsing, and custom browser UIs for cloud browsers, and hack on top of it. I wanted to release something with a very permissive license, that might spark people's imaginations about how they could use this kind of tech in their own project. I wanted something I could build in 1 day (and indeed, it took me around 6 hours). I wanted something where I wasn't restricted by the need to keep the license strict (e.g., AGPL-3.0), in order to preserve my business of selling corporate license exceptions and SaaS deployments.

I wanted to give people a way they could get their toes wet, without having to pay anything, and so they might build their own on top of it. Because the type of people who would probably find this useful to hack on, are not the type of people who want to pay for a corporate license.

so, how simple is it?

A single NodeJS file that serves everything, 350 source lines of code, 6 endpoints (5 GET, 1 POST), 1 export and 3 external imports (express, mjpeg-server, and of course puppeteer).

okay, but how you size the remote browser viewport to roughly match my screen without any client-side JavaScript, what crazy majyck is this?

With, my friend, the following ingenious idea:

{ const ua = req.headers['user-agent']; const isMobile = testMobile(ua); let {width,height} = req.params; width = parseFloat(width); height = parseFloat(height); await page.emulate({ viewport: { width, height, isMobile }, userAgent: ua }); ... ">
/* code to set the viewport approx size without client side JS */
    // for all w and h combinations that are relevant
    `@media screen and (min-width: ${w}px) and (min-height: ${h}px) {
      body {
        background-image: url("/set-viewport-dimensions/width/${w}/height/${h}/set.png") 
      }
    }`

    app.get('/set-viewport-dimensions/width/:width/height/:height/set.png', async (req, res) => {
      const ua = req.headers['user-agent'];
      const isMobile = testMobile(ua);
      let {width,height} = req.params;

      width = parseFloat(width);
      height = parseFloat(height);
     
      await page.emulate({
        viewport: {
          width,
          height,
          isMobile
        },
        userAgent: ua
      });
    ...

How can I too?

Alternative install mantras:

$ npx puppetromium@latest 8080
# or
$ npm i -g puppetromium@latest
$ puppetromium 8080

Or:

$ npm i --save puppetromium

Then:

import {start} from 'puppetromium';
start({port:8080, url:'https://jspaint.app'});

Or:

$ git clone https://github.com/i5ik/puppetromium.git
$ cd puppetromium/
$ npm i 
$ npm start 8080

HELP! It broke

It's probably because of puppeteer dependencies. Make sure you have them all installed. I included a bunch of dependency scripts tailed to Debian (which may work on other Linuxes, but your mileage may encounter variability).

You might also like...

Hemsida för personer i Sverige som kan och vill erbjuda boende till människor på flykt

Getting Started with Create React App This project was bootstrapped with Create React App. Available Scripts In the project directory, you can run: np

May 3, 2022

Kurs-repo för kursen Webbserver och Databaser

Webbserver och databaser This repository is meant for CME students to access exercises and codealongs that happen throughout the course. I hope you wi

Jan 3, 2023

Device.js is a JavaScript library to detect device, viewport, and browser information using plain JavaScript.

Device.js Device.js is a JavaScript library to detect device, viewport, and browser information using plain JavaScript. Compatibility Works with all m

Dec 16, 2022

Fast and minimal JS head server-side writer and client-side manager.

unihead Fast and minimal JS head server-side writer and client-side manager. Nearly every SSR framework out there relies on server-side components t

Sep 4, 2022

Easy server-side and client-side validation for FormData, URLSearchParams and JSON data in your Fresh app 🍋

Fresh Validation 🍋     Easily validate FormData, URLSearchParams and JSON data in your Fresh app server-side or client-side! Validation Fresh Validat

Dec 23, 2022

The high efficent browser driver on top of puppeteer, ready for production scenarios.

The high efficent browser driver on top of puppeteer, ready for production scenarios.

browserless is an efficient driver for controlling headless browsers built on top of puppeteer developed for scenarios where performance matters. High

Jan 6, 2023

Automagically bypass hcaptcha challenges with http api, with puppeteer, selenium, playwright browser automation scripts to bypass hCaptcha programmatically

Automagically bypass hcaptcha challenges with http api, with puppeteer, selenium, playwright browser automation scripts to bypass hCaptcha programmatically. For help you can message on discord server with the bellow link. You can also create an issue.

Jan 2, 2023

this is a single-page web application. we built a book website where the user can add , remove and display books. we used modules to implement these functionalities. also, we used the Date class to display the date and time.

Awsome Books In this Project, we have built A Books websites. Built With 🔨 HTML CSS javascript Git & Github Live Demo Here you can find the live Demo

Aug 3, 2022

This tool uses native browser APIs to take screenshots of a given web page, tab, window, or the user's entire screen.

This tool uses native browser APIs to take screenshots of a given web page, tab, window, or the user's entire screen.

This tool uses native browser APIs to take screenshots of a given web page, tab, window, or the user's entire screen.

Jan 1, 2023

Converts geojson to svg string given svg viewport size and maps extent.

geojson2svg Converts geojson to svg string given svg viewport size and maps extent. Check world map, SVG scaled map and color coded map examples to de

Dec 17, 2022

🛤 Detection of elements in viewport & smooth scrolling with parallax.

Locomotive Scroll Detection of elements in viewport & smooth scrolling with parallax effects. Installation ⚠️ Scroll-hijacking is a controversial prac

Dec 31, 2022

A plugin for PostCSS that generates viewport units (vw, vh, vmin, vmax) from pixel units

A plugin for PostCSS that generates viewport units (vw, vh, vmin, vmax) from pixel units. The best choice to create a scalable interface on different displays by one design size.

Dec 29, 2022

A ScrollSpy library for detecting enter/exit of elements in the viewport when the user scrolls

jquery-scrollspy A jQuery plugin for detecting enter/exit of elements in the viewport when the user scrolls. New Features Added a couple new features:

Jul 1, 2022

Lazyload images, iframes or any src* element until they are visible in the viewport.

Lazyload images, iframes or any src* element until they are visible in the viewport.

Nov 15, 2022

Browser tab reload automation.

SpeedFeed Browser tab reload automation. Report Bug · Request Feature · View License (back to top) Contributing Contributions are what make the open s

Aug 10, 2022

Obsidian plugin to open a note of your choice when creating a new tab, like in the browser.

Obsidian plugin to open a note of your choice when creating a new tab, like in the browser.

New Tab Default Page Obsidian plugin to open a note of your choice when creating a new tab, like in the browser. Usage Set the note to open in new tab

Dec 27, 2022

New tab browser extension (aka startpage) with nord colors and a dancing goose.

Nordic goose Nordic goose is a new tab extension (aka startpage) with nord colors and a dancing goose. Features: 🦆 Look at a dancing goose 🎨 Beautif

Dec 30, 2022
Owner
Cris
Making real some ideas that want to be born.
Cris
Playwright is a framework for Web Testing and Automation. It allows testing Chromium, Firefox and WebKit with a single API.

?? Playwright Documentation | API reference Playwright is a framework for Web Testing and Automation. It allows testing Chromium, Firefox and WebKit w

Microsoft 46.3k Jan 9, 2023
Demo Selenium JavaScript E2E tests (end-to-end web browser automation tests)

Demo Selenium JavaScript E2E tests (end-to-end web browser automation tests)

Joel Parker Henderson 1 Oct 9, 2021
blanket.js is a simple code coverage library for javascript. Designed to be easy to install and use, for both browser and nodejs.

Blanket.js A seamless JavaScript code coverage library. FYI: Please note that this repo is not actively maintained If you're looking for a more active

Alex Seville 1.4k Dec 16, 2022
☕️ simple, flexible, fun javascript test framework for node.js & the browser

☕️ Simple, flexible, fun JavaScript test framework for Node.js & The Browser ☕️ Links Documentation Release Notes / History / Changes Code of Conduct

Mocha 21.8k Dec 30, 2022
A Node.js tool to automate end-to-end web testing.

A Node.js tool to automate end-to-end web testing. Write tests in JS or TypeScript, run them and view results. Homepage • Documentation • FAQ • Suppor

Developer Express Inc. 9.5k Jan 9, 2023
Meogic-tab-manager is an extensible, headless JavaScript tab manager framework.

MeogicTabManager English document MeogicTabManager是一个有可拓展性的、headless的JavaScript标签页管理框架。 MeogicTabManager旨在提供可自由组装页面框架、自定义页面组件、甚至覆盖框架自带事件响应的开发体验。 Meogi

meogic-tech 5 Oct 8, 2022
A decentralized Music Ownership System developed on Truffle Suite and React Bootstrap to allow Music artists to upload their content to the blockchain, that can be streamed by users

A decentralized Music Ownership System developed on Truffle Suite and React Bootstrap to allow Music artists to upload their content to the blockchain, that can be streamed by users.

M. Adil Fayyaz 10 Sep 5, 2022
A single-page application that allows users to keep track of their books. Users can add the book details (book title and author) and also, and the books can also be removed. Built with JavaScript, HTML, and CSS

Project Name Awesome book with ES6 Description the project. This is a single page application that allows users to keep track of their books. Users ca

Micheal Oguntayo 4 Oct 13, 2022
A bot builder on top of puppeteer's headless web browser mimicing your web.whatsapp.com functionalities.

Welcome to the BizBook365 WhatsApp bot project A bot builder on top of puppeteer's headless web browser mimicing your web.whatsapp.com functionalities

Foyzul Karim 19 Dec 1, 2022
Grupprojekt för kurserna 'Javascript med Ramverk' och 'Agil Utveckling'

JavaScript-med-Ramverk-Laboration-3 Grupprojektet för kurserna Javascript med Ramverk och Agil Utveckling. Utvecklingsguide För information om hur utv

Svante Jonsson IT-Högskolan 3 May 18, 2022