Browser in Javascript
A Proof-of-Concept Browser written in Javascript for minimal Web 2.0 browsing experience. This DOES NOT depend on any browser engine like Blink, Gecko or Webkit. Use an existing HTML rendering engine like netsurf or roll-out your own.
This uses QuickJS-ng for JS runtime, Linkedom for DOM API and curl for network downloads. Font decoration uses Terminal ANSI escape codes.
Since linkedom is an npm module, it needs to be converted to ES6 module for use with quickjs.
npm install linkedom
npx esbuild node_modules/linkedom/esm/index.js \
--bundle \
--format=esm \
--outfile=linkedom.bundle.js \
--platform=neutral
npx esbuild node_modules/linkedom/esm/index.js \
--bundle \
--format=esm \
--outfile=linkedom.bundle.js \
--platform=neutral
Code
- https://gitlab.com/atamariya/quickjs/-/blob/dev/ldom.js
- https://gitlab.com/atamariya/quickjs/-/blob/dev/net.js
- https://gitlab.com/atamariya/quickjs/-/blob/dev/render.js
Lessons Learnt
- std.urlGet() only supports stateless downloads. For form posts, header manipulation and cookie management, curl is used.
- curl can generate HTTP status code with -w option.
References
Comments
Post a Comment