JavaScript and the Browser - TristanVarewijck/Block-Tech GitHub Wiki
A computer can use Network to shoot bits to a another computer for any effective communication the computer must know what the bits are supposed to represent.
A Network Protocol describes a style of communication over a network. For example the Hypertext Transfer Protocol (HTTP) is a protocol for retrieving named resources such as webpages or pictures.
The Transmission Transfer Protocol (TTP) ensures that the shooting bits arrive at the right destination. Because if a computer wants to speak there must be another computer listening. For example: if we send a email using the SMPT Protocol, the machine through which we send it is expected to be listening on port 25.
The Worldwide web is a set of protocols that allows us to visit webpages using the browser. Each document on the Web is named by a Uniform Resource Locator (URL) , which looks something like this:
http://eloquentjavascript.net/13_browser.html | Eloquent JavaScript 3rd edition (2018)
If you type this URL into your browser’s address bar, the browser will try to display the document at that URL
First: The browser needs to find out what eloquentjavascript.net refers to.
Second: Using the HTTP protocol, it will make a connection to the server at that address and ask for the resource /13_browser.html
The most important HTML tag is the <script> tag. This tag allows us to include JavaScript to our projects. The linked JavaScript will run while the browser reads the HTML.
Example of the <script> tag: <script src="app.js"></script>
"Running programs by people who do not mean well is how you get your computer infected by viruses, your data stolen, and your accounts hacked."
Thats why browsers limit the things that JavaScript can do. For example: It CANT'T look into your computer files or modify anything not related to the webpage it was embedded in. This kind of limiting is called sandboxing. JavaScript can still do a LOT just not the things that could be fatel for normal users. Hackers tend to find ways around sandboxing.
"At any point where a single browser was dominant, that browser’s vendor would feel entitled to unilaterally invent new features for the Web. Since most users used the most popular browser, websites would simply start using those features—never mind the other browsers"
But also developers would make features that only worked on the most populair browsers so users of older browsers couldn't use those features. This is where the term browser wars came from.
-Javascript and the Browser | Eloquent JavaScript 3rd edition (2018)