Skip to main content
gamedev.net
🔒 Locked

Creating a basic web browser

Started by Sfpiano Aug 7, 2005 at 9:27 PM 11 replies 1.5k views
Original Post
Sfpiano
Sfpiano
I decided for my next little project it might be fun to create a web browser; however I'm not exactly sure where to start. Would I have to parse the HTML myself and go from there?
//------------------------------------------------------------------------------------------------------The great logician Bertrand Russell once claimed that he could prove anything if given that 1+1=1. So one day, some fool asked him, "Ok. Prove that you're the Pope." He thought for a while and proclaimed, "I am one. The Pope is one. Therefore, the Pope and I are one."
Mobile
Mobile
Apparently you've never done anything with VB ;)
Sfpiano
Sfpiano
I don't want to use VB, because that does everything for you; besides I haven't used that in years. The point of this exercise for me is to learn how things work, not to throw something together. If I wanted that, I would just create an MFC app using CHtmlView.
//------------------------------------------------------------------------------------------------------The great logician Bertrand Russell once claimed that he could prove anything if given that 1+1=1. So one day, some fool asked him, "Ok. Prove that you're the Pope." He thought for a while and proclaimed, "I am one. The Pope is one. Therefore, the Pope and I are one."
Mobile
Mobile
Fair enough. Have you considered trying to write your own HTML engine or are you just looking to use MSHTML?
Mattman
Mattman
It depends on what you want to learn. Are you trying to learn what data passes between the client/server? Use some sort of socket, not a library to do it for you. Are you trying to learn how to display HTML? Then again, don't use a library for it.

I'm not sure what aspects you're trying to get a learning experience out of. That should really make up your mind whether you should parse HTML and such, as you asked.
Sfpiano
Sfpiano
I guess I start with parsing html. My question is how I'd start that, the actual process of turning html into something on screen.
//------------------------------------------------------------------------------------------------------The great logician Bertrand Russell once claimed that he could prove anything if given that 1+1=1. So one day, some fool asked him, "Ok. Prove that you're the Pope." He thought for a while and proclaimed, "I am one. The Pope is one. Therefore, the Pope and I are one."
dbzprogrammer
dbzprogrammer
Well, I can't give the exact low down on how to do that, but if you know HTML, it shouldn't be a problem. Look at a part of HTML, and ask yourself what does that do? Once you know what it does think about different ways you could make it happen. Say it's a center tag. Find out how many characters can fit into a row on the screen. Subtract the number of characters that needs to be centered. Then divide by 2 and that will be how much space you need to tab over before you output that text. Following me?
We should do this the Microsoft way: "WAHOOOO!!! IT COMPILES! SHIP IT!"
bjz
bjz
Quote:
Original post by Sfpiano
I guess I start with parsing html. My question is how I'd start that, the actual process of turning html into something on screen.


I'm by no means trying to bash you, but if you dont atleast have a vague idea of where to begin then I believe your being a little to ambitious. I only say this because a few years ago when I was first learning windows api I thought the same thing. I quickly learned it was out of my current scope, so I worked on smaller less ambitious projects. Now I have a partially complete html parsing class. Only partially complete because I only work on it like once a month if that. :D I have been working on my own game engine primarily.
markr
markr
There are really two basic ways of doing this

1. The easy way:

Create an application which embeds Gecko (from Mozilla), MSHTML (Ships with Windows; part of MSIE) or KHTML / Applewebkit (Used in Konqueror / Safari). There are other less well known HTML rendering engines around, but they're generally not as good.

2. The hard way:

Parse the HTML and write your own layout engine, your own CSS engine etc. Embed an existing &#106avascript engine (if desired). <br/><br/>This will be enormously difficult. You can get existing HTML parsers (I'm using the libxml2), but I've drawn a blank with a usable embeddable CSS interpreter (i.e. something which can read CSS and then tell me what styles apply to a given element for rendering)<br/><br/>Mark
weck
weck
Several days before. i embed the IE into our game, but at last ,we give up . :) here are some links i collected, it may give you some help. :)

http://blog.360.yahoo.com/blog-snn8VuQrdLOqLz3TCGLzfNGuJM8-?l=6&u=11&mx=11&lmt=5&p=7
JY
JY
It would certainly be a good project to learn many aspects of programming; networking, graphical interface, optimal data structure etc. etc. Good luck with that!

If you're planning on making it standards compliant there is an awful lot of reading to do first. The CSS and XHTML specs are pretty big.
"Absorb what is useful, reject what is useless, and add what is specifically your own." - Lee Jun Fan

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.