Browse++
- 8 Devlogs
- 19 Total hours
A Pure C++ web engine from scratch to render websites, fast.
A Pure C++ web engine from scratch to render websites, fast.
You can try it online! : https://k754a.hackclub.app/
Source code: https://github.com/k754a/C-Plus-Plus-Web-Engine
I’m building a super-fast, pure custom C++ browser engine from scratch, and the thing I built today was an HTML parser!
HTML parsers are super hard to code, thanks to HTML being a very loose markup language. There can be tons of stuff, like:
Missing divs
<div>Hello World!</p></div>
Missing end tags
<img src="image.png"
Even nested divs!
<div class="container"><span>Nested Elements</span></div>
So I needed to build a parser that could handle all of it.
Another challenge I’ve been trying is forcing myself to stop making variables for everything and trying to be minimal and fast! This new update also added local HTML loading; this lets me test much faster and test certain things, especially for the DOM and render tree!
Some struggles I ran into while building this project were just the amount of errors and debugging I had to do to figure out what went wrong, as well as working with large pieces of code with constant changes.
This part really taught me about data types, how to find and remove elements from multiple different classes and types, how to make loops efficient, and how to use vectors!
My plan for the next devlog will be building a DOM tree or getting HTTPS to work. After doing some research, I found that I can use:
#include <wininet.h>
to help get this thing working, so that’s my plan!
Okay, this was super long. Thanks for looking at it. The video linked below is a demo of it loading and tokenizing some text locally on a machine!
In this devlog I built the first half of my parser for the web engine; it can go through a website and match tokens!
There are a few issues; some things, like conditions (like <a href=> arnt supported), as well as I can’t pull text from things like headers and stuff.
I also made an animation so people can see how it works! The animations basically shows how my buffer system, and determining the order of tokens works, to prevent things like mismatches!
I was able to build a website demo for people to try out. To make this, I ran it on the Nest servers from Hack Club! However, I used a bit of AI, as I had never set up a server, as well as my project being only built for Windows. However, AI still hasn’t and will not be used in the main project. I did this as a bit of a time saver and to not have to commit 40+ times to test it lol. https://k754a.hackclub.app/
First version of the browser.
It is currently all through the terminal; there is no formatting, CSS, JavaScript, fonts, styles, or even structure to the text. However, any HTTP website can now be rendered into readable text, even if it’s a bit hard to see, lol!
The next version of this, I’m going to hook up a rendering pipeline (not sure to what yet, though). Then it will be allowing different fonts and structures, and then finally, support for some CSS.
What I have just described will probably take 200 hours!
I update the web browser engine to allow the download of full files from websites in HTTP. This will pave the way to let me parse the website for the next devlog!
Some more changes I made were a bit more error handling and also refining some of the output to make it cleaner and retiring some of the older debug logs.
The next difficult part will be some basic parsing and pulling out text
Then I’ll attempt to render text without position (this will take about ~4 hours), and then I’ll work on formatting.
I built the first version of my web client. It can now pull HTML data from HTTP sites, using a TCP socket.
If you don’t know what I’m working on, I’m building a pure C++ browser engine, to load and render websites like google without the use of AI and libraries.
Note that it does not work for https, as to build a handshake between the 2 is super difficult, even for a good programmer.
The next step will be to pull an entire webpage off and save it in RAM.
Thanks for reading, and I hope you follow my journey!
Using C++ and native windows libraries, i was able to connect to a website and pull some data off of it.
this was super difficult, but im super happy it worked, its able to connect to any IPV4, http site.
my next plan is to start pulling files, like html into ram from websites.
The overall of my essay, is just laying out how im going to be building a web engine
from scratch. its not going to run JavaScirpt or interface with HTTPS off the bat, as i
have to code all of that and it sucks.
https://github.com/k754a/C-Plus-Plus-Web-Engine/blob/main/README.md
(this is a link to it as i could not upload a pdf file.)
Overall, this will be one of the most complex projects I’ve ever tried/attempted to
take on, even over https://github.com/k754a/C-Custom-Code-Editor by a long shot.
This will 100% test my research, development, and C++ skills, but I believe that even
if I’m not able to pull this off, I will learn a lot about how browsers work and good
C++ practices. I hope you will follow my progress on GitHub and Stardance as I build
this!