code

웹 브라우저 구축을 시작하는 방법은 무엇입니까?

codestyles 2020. 11. 16. 08:20
반응형

웹 브라우저 구축을 시작하는 방법은 무엇입니까?


처음부터 웹 브라우저를 구축하기 위해 노력하기로 결정했습니다. 시작하기 전에 알아야 할 최신 웹 브라우저의 일반적인 기능, 아키텍처 및 기능은 무엇입니까?

모든 권장 사항을 높이 평가합니다!


그것을 조각으로 나누십시오. 웹 브라우저 란 무엇입니까? 그것은 무엇을합니까? 그것:

  • 외부 콘텐츠를 가져옵니다. 따라서 HTTP 라이브러리가 필요하거나 (권장되지 않음) 직접 작성하십시오. HTTP 프로토콜에는 많은 복잡함 / 미묘함이 있습니다. 예를 들어 만료 헤더 처리, 다른 버전 (요즘에는 대부분 1.1 임) 등;
  • 다양한 콘텐츠 유형을 처리합니다. 피기 백 할 수있는 이런 종류의 Windos 레지스트리가 있습니다. 여기서는 MIME 유형을 기반으로 콘텐츠를 해석하는 것입니다.
  • HTML 및 XML 구문 분석 : DOM (문서 개체 모델)을 만듭니다.
  • CSS 구문 분석 및 적용 : 모든 속성, 모든 측정 단위 및 값을 지정할 수있는 모든 방법 (예 : "border : 1px solid black"대 별도의 테두리 너비 등 속성)을 이해해야합니다.
  • W3C 시각적 모델을 구현합니다 (그리고 이것이 진정한 키커입니다).
  • 자바 스크립트 엔진이 있습니다.

그리고 그것은 기본적으로 웹 브라우저입니다. 이제 이러한 작업 중 일부는 매우 복잡합니다. 쉽게 들리는 것조차 어려울 수 있습니다. 외부 콘텐츠를 가져옵니다. 다음과 같은 사용 사례를 처리해야합니다.

  • 사용할 동시 연결 수는?
  • 사용자에게 오류보고
  • 프록시;
  • 사용자 옵션;
  • 기타

나와 다른 사람들이 공동으로 눈썹을 올리는 이유는 렌더링 엔진이 어렵 기 때문입니다 (누군가 지적했듯이 인간의 세월이 개발에 들어갔습니다). 주변의 주요 렌더링 엔진은 다음과 같습니다.

  • Trident : Microsoft에서 Internet Explorer 용으로 개발했습니다.
  • Gecko : Firefox에서 사용됩니다.
  • Webkit : Safari 및 Chrome 0-27에서 사용됩니다.
  • KHTML : KDE 데스크탑 환경에서 사용됩니다. Webkit은 몇 년 전에 KHTML에서 포크되었습니다.
  • Elektra : Opera 4-6에서 사용됨;
  • Presto : Opera 7-12에서 사용됨;
  • Blink : Chrome 28+, Opera 15+, 웹킷 포크에서 사용됩니다.

상위 3 개는 오늘날 사용되는 주요 렌더링 엔진으로 간주되어야합니다.

자바 스크립트 엔진도 어렵습니다. 특정 렌더링 엔진에 연결되는 경향이있는 몇 가지가 있습니다.

  • SpiderMonkey : Gecko / Firefox에서 사용됩니다.
  • TraceMonkey : Firefox 3.1에서 SpiderMonkey를 대체하고 JIT (just-in-time) 컴파일을 도입합니다.
  • KJS : Konqueror에서 사용, KHTML에 연결됨;
  • JScript : Internet Explorer에서 사용되는 Trident의 자바 스크립트 엔진.
  • JavascriptCore : Safari 브라우저의 Webkit에서 사용됩니다.
  • SquirrelFish : Webkit에서 사용되며 TraceMonkey와 같은 JIT를 추가합니다.
  • V8 : Chrome 및 Opera에서 사용되는 Google의 자바 스크립트 엔진
  • Opera (12.X 이하)도 자체적으로 사용했습니다.

물론 페이지 간 탐색, 페이지 기록, 임시 파일 지우기, URL 입력, URL 자동 완성 등과 같은 모든 사용자 인터페이스가 있습니다.

그것은 많은 일입니다.


정말 흥미로운 프로젝트처럼 들리지만 엄청난 노력을 투자해야합니다.

쉬운 일은 아니지만 학문적 관점에서 볼 때 많은 것을 배울 있습니다.

확인할 수있는 몇 가지 리소스 :

그러나 현실적인 관점 에서 보았을 때 처음부터 코드를 작성하는 데 필요한 엄청난 노력은이 만화를 생각 나게했습니다.


(출처 : geekherocomic.com )

행운을 빕니다 :-)


이 프로젝트는 엄청나게 야심 찬 프로젝트이지만 (특히 단일 개발자를위한) 언젠가하고 싶은 일입니다.이 프로젝트에서 많은 것을 배울 수 있습니다.

프로토콜이 어떻게 작동하는지 (확실히 조사해야 할 사항) 또는 브라우저에서 진행되는 작업에 대해 많이 알지 못하지만 시작하기 좋은 곳은 주로 Chrome과 같은 오픈 소스 브라우저의 소스 일 것입니다. Firefox. Chrome은 브라우저의 크롬과 백엔드와 같이 내가 시작할 것으로 기대하는 작업 만 수행하므로 특히 좋은 프로젝트입니다. 처음에는 렌더링 엔진을 만드는 것을 잊어 버려-Webkit 또는 Gekko를 사용하십시오.


자신의 렌더링 엔진을 작성하는 것과 같은 의미입니까?

행운을 빕니다. 다양한 브라우저의 현재 세대에 많은 사람이 들어갔습니다. 둘 중 하나보다 더 잘하고 싶다면 심각한 기술이 필요합니다. 어디서부터 시작해야하는지 물어봐야한다면 그러한 작업을 시도하는 것이 합리적이기 전에 몇 년 이상의 연구를 거쳐야 할 것입니다.

즉, 다음은 몇 가지 (명백한) 포인터입니다.

  1. 모든 projecteuler.net 문제를 해결하는 것과 같이 작은 일을하는 많은 코드를 작성 합니다.
  2. 툴킷과 커뮤니티 표준에 대해 가능한 모든 것을 배우십시오.
  3. 더 많은 코드 작성
  4. 유한 상태 기계에 대한 확실한 이해
  5. 더 많은 코드 작성
  6. tcp / ip 스택에 대한 모든 정보와 http에 사용되는 방법을 배웁니다.
  7. http에 대해 가능한 모든 것을 배우십시오.
  8. 표준 학습 (html, xml, sgml, css)
  9. 150 번째 생일을 축하하세요.
  10. 실제 브라우저 프로젝트를 시작하십시오.

edit below here

I didn't mean for it to be either motivating or demotivating, just an attempt to show you that a browser is a really big project and that really big projects require a whole lot of thought. Blunt honesty sprinkled with humour.

I've been programming for over two thirds of my life and I like to think that I am a pretty decent programmer, but it would be foolish of me to think that I'd stand half a chance at writing a decent web browser from scratch.

Ofcourse, if this is what you want to do, don't let my comment stand in your way. You can probably do better than Internet Explorer.


Most modern web browsers are giant beasts, and probably fairly poorly designed because they (and the web itself) evolved in a rather haphazard way.

You need to start by first making the goals of your project (and what you hope to achieve) very explicit. Is this something you're just doing for fun, or do you expect other people to use your browser? If you expect others to use it, what will the incentive for them be? It is unrealistic to expect that you will develop a new browser from scratch that everyone will be able to use as a replacement for Chrome, Safari, Firefox, IE, Opera, etc. All of those projects have a 10-15 year head start on you, and by the time you've caught up to them, they will be another 10-15 years ahead of you. Plus they have a lot more man power behind them, and so if you want your project to be successful, you will need that man power at some point.

This is the reason that Apple and Google, big companies with lots of resources, did not start from scratch. Not even Microsoft started from scratch. The original IE was based on Mosaic. The only significant browsers still around today that were started from scratch are Opera, Konqueror and Lynx, which unfortunately all have minuscule market share. Let's forget about Lynx for the moment, since it's a text-only browser and presumably the only reason it's still around is because it serves that specific niche. Opera is arguably one of the best browsers ever made, and yet it's never had a great market share, so remember that success and innovation are not the same thing. KHTML is the engine behind Konqueror, which never itself became very successful, but is the basis of WebKit that both Apple and Google use. I think one could definitely argue that if KHTML had never been made, neither Safari or Chrome would exist. Interestingly enough, both KHTML and Opera were largely produced by Norwegian programmers working in the same building in Oslo.

You need to look at building a web browser like building an operating system, because that's essentially what a browser is -- it's an operating system for running web apps. And like an operating system, a web browser is a very complex piece of software with many components. Of course, people have been successful at creating new operating systems from scratch. Linus Torvalds comes to mind. He made Linux, one of the most successful operating systems ever.

Of course, you face an additional challenge, which makes building a new successful browser harder than building a new successful OS. Browsers are expected to flawlessly run all the legacy code floating around on the web. Now suppose that Linus Torvalds had been told that his new OS wouldn't matter unless it was perfectly backwards compatible with UNIX or some existing OS. I doubt he would have bothered, and Linux probably wouldn't exist today. Realistically, of course, the only reason Linux became popular was because it was designed well and the GNU project was able to make tools for porting huge amounts of existing code to Linux. Without GNU's ideological support for Linux, it never would have had a chance.

So assuming you really are ambitious (or foolhardy) enough to try to make a new successful browser, the thing you should be focusing on is architecture and design. There is no practical reason to build a new browser from scratch unless you are sure you can improve upon the design of existing browsers in some way. That means you need to familiarize yourself enough with the code of WebKit and Gecko enough to understand the design decisions they made, but you shouldn't be attempting to copy their design because otherwise you might as well just use their code.

My personal thoughts (without having done enough research) is that today's browsers are not modular enough. If I were going to make a new browser, I would find a way to make it easy to swap things in and out (like replace one JavaScript engine with another), and give the user a lot more control than they currently have with existing browsers. Modern browsers and web designers have taken almost all control away from the user. Why can't I, the user, tell the web browser how I want it to render content being displayed on my machine? The original HTML only gave guidelines for how to structure content, and over time, newer standards have become more and more dogmatic, to the point where the user is now at the total mercy of the web designer. The appeal of Linux was that it gave back control to the user, and that's why so many geeks supported it and made it into a successful OS.

The other thing I would spend time researching, if I were you, is operating system design principles. Designing a good browser, should at least in theory, require the same principles as designing a good OS -- especially in regards to concurrent processes, security models, etc.

Finally, after having done lots and lots of research, this is where you should start coding I think:

  1. Re-engineer Mosaic, but with your own design ideas. This is also what I would suggest if your are just doing it for fun or your own educational benefit. Read the original HTML 1.0 and HTML 2.0 specs, as well as the HTTP 1.1 specs and the current URI specs, and make sure your browser adheres to all those specs. You can of course download existing software that already handles the transport protocols, URI conventions, etc. but if you're serious about designing your own browser, I think it is a good exercise to do these things from scratch as well, so you get a good sense of how all the puzzle pieces fit together. At the end of step 0, you should have a browser that is at least comparable to what was state-of-the-art in the 90's. This is a good first milestone. And you can actually download the original Mosaic at ftp://ftp.ncsa.uiuc.edu/Mosaic/ and see how it compares with your browser. It's also a good exercise to see how current websites render in an ancient browser like Mosaic.

  2. Add support for the DOM to your browser. Focus on W3C DOM Level 1 and Level 2 first, since pretty much all current browsers support those completely. Then look at Level 3 and Level 4. The DOM is extremely fundamental to web programming, and so if you're going to actually build a modern web browser, it's entire design has to take this into consideration. Since you are writing the browser in C# you may want to take into consideration how you could leverage the existing .NET object model to your advantage.

  3. Look at existing scripting engines and see if you can port them to your project. I'd discourage you from writing your own JavaScript interpreter, not only because that's a very large project in itself, but because so much work has already been put into optimizing JS compilers (e.g. V8). So unless you're a guru in compiler design, your hand-built JS interpreter will likely be inferior to what's already out there, even if it follows the EMCAScript specs flawlessly. Again, I think the scripting engine should be something that is a completely separate module from the actual browser anyway, so I think it would be much more useful to have a framework that allows you to substitute any scripting engine, rather than build a scripting engine that only works with your browser.

  4. Look at the HTML / CSS / JS source code for the top 10-20 websites in North America (Google, Facebook, YouTube, Twitter, Wikipedia, Amazon, popular blogging platforms, etc.) and engineer your browser to work well with these sites. This is a somewhat more tractable problem to solve than making a browser that adheres to all the existing standards (something that current browsers still don't do perfectly) much less making a browser that correctly renders all the web sites on the web (nobody can do that). People will complain that your browser breaks standards and so-forth, but that's not as big of a problem as people complaining that they can't access Google or Facebook with your browser. I can't think of any browser that correctly followed all (or even most) standards on its first release, so I say don't even bother trying. If you can make something that people will want to use enough that there will ever be a 2nd or 3rd version, then you can worry about standards at that point.


As everyone else has already said, a web browser is a huge project. You've got to worry about tcp/ip&sockets, rendering html, using css, creating a DOM model, executing javascript, dealing with malformed markup and code, and handling all types of files before you can even think about all the things people expect from a browser (ie bookmarks, history, private browsing, security, etc.) It's a huge project.

That being said, it can be done. My suggestion would be to go look at the source of Firefox. I know that you said you want to build a browser from scratch, but it would be very helpful to learn from an open-source project, first.

I would download the Firefox source, and slowly strip it down. In other words, I would take the source and remove all bookmarking functionality. Then, I'd remove the ability to handle addons. Then, I'd delete all code regarding saving files. I would continue this process until I got a very basic web browser. I'd look over that code.

Then, I'd start building my own. I'd take the knowledge I'd gained from taking apart Firefox, and I'd put it into building a new browser.

A whole lot of luck to you!


Udacity now has a course called "Building a Web Browser" - https://www.udacity.com/course/programming-languages--cs262


You could start with well-formed and valid XHTML, which should be easier than the tag soup your browser will encounter in real "life".

Then you must find a way to bend the real HTML from the web to your needs.

But don't kid yourself: A browser isn't a small project.


...then start worrying about security

(non-functional and cross cutting concerns should be generally considered up front though :) )


very ambitious project but one developer can't do this alone you need a team(project manager , testers ...) and maybe you should review your choise of language c# works only on windows(i know mono on linux but it is not the same) anyway i wish you good luck and i ll be happy to use your browser :D


You really have a lot of free time in your hand, haven't you? AFAIK, most browsers were written in C++, not all users have the .NET framework installed on their computers and if they do it might not be the version you need.

This could take you years but anyway, there are many open source browsers out there, FireFox, Google Chrome .. etc, you could start by having a look on the code, good luck with that :)

참고URL : https://stackoverflow.com/questions/598841/how-to-get-started-building-a-web-browser

반응형