{"id":2300,"date":"2024-08-25T08:12:16","date_gmt":"2024-08-25T08:12:16","guid":{"rendered":"https:\/\/www.shawnmeanders.com\/blog\/?p=2300"},"modified":"2024-08-25T08:12:16","modified_gmt":"2024-08-25T08:12:16","slug":"webpages-front-end-introduction","status":"publish","type":"post","link":"https:\/\/www.shawnmeanders.com\/blog\/2024\/08\/25\/webpages-front-end-introduction\/","title":{"rendered":"Webpages &#8211; Front-end introduction"},"content":{"rendered":"\r\n<p class=\"wp-block-paragraph\">\r\n<i>This was written August 25, 2024<\/i>.\r\n<\/p>\r\n\r\n<h2>Introduction<\/h2>\r\n<p>\r\nAh, the web. It&#8217;s become almost ubiquitous nowadays. But although it used to be accessed mostly through browsers and webpages, it&#8217;s now often accessed directly through 1st party apps instead. Regardless, I think browsers and webpages still have a lot of value, and so does understanding them. For this reason, I want to dive further into how these actually work, so let&#8217;s get started.\r\n<\/p>\r\n\r\n<h2>Basic Architecture<\/h2>\r\n<p>\r\nFirst of all, most web interactions are broken into two components, a server and a client (Note that nowadays this isn&#8217;t always cut-and-dry, but it&#8217;s still often the case, especially for simpler situations):\r\n<ul>\r\n  <li>The server is the remote machine that contains all the necessary information, and knows how to aggregate it and send it to the user.<\/li>\r\n  <li>The client is the user&#8217;s interface, usually the machine they use, whether it be a smartphone, a tablet or a computer.<\/li>\r\n<\/ul>\r\n<\/p>\r\n<figure id=\"attachment_2334\" aria-describedby=\"caption-attachment-2334\" style=\"width: 660px\" class=\"wp-caption aligncenter\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/www.shawnmeanders.com\/blog\/wp-content\/uploads\/2024\/08\/server-client-1024x944.png\" alt=\"\" width=\"660\" height=\"608\" class=\"size-large wp-image-2334\" srcset=\"https:\/\/www.shawnmeanders.com\/blog\/wp-content\/uploads\/2024\/08\/server-client-1024x944.png 1024w, https:\/\/www.shawnmeanders.com\/blog\/wp-content\/uploads\/2024\/08\/server-client-300x277.png 300w, https:\/\/www.shawnmeanders.com\/blog\/wp-content\/uploads\/2024\/08\/server-client-768x708.png 768w, https:\/\/www.shawnmeanders.com\/blog\/wp-content\/uploads\/2024\/08\/server-client-250x231.png 250w, https:\/\/www.shawnmeanders.com\/blog\/wp-content\/uploads\/2024\/08\/server-client-550x507.png 550w, https:\/\/www.shawnmeanders.com\/blog\/wp-content\/uploads\/2024\/08\/server-client-800x738.png 800w, https:\/\/www.shawnmeanders.com\/blog\/wp-content\/uploads\/2024\/08\/server-client-195x180.png 195w, https:\/\/www.shawnmeanders.com\/blog\/wp-content\/uploads\/2024\/08\/server-client-325x300.png 325w, https:\/\/www.shawnmeanders.com\/blog\/wp-content\/uploads\/2024\/08\/server-client-542x500.png 542w, https:\/\/www.shawnmeanders.com\/blog\/wp-content\/uploads\/2024\/08\/server-client.png 1298w\" sizes=\"auto, (max-width: 660px) 100vw, 660px\" \/><figcaption id=\"caption-attachment-2334\" class=\"wp-caption-text\">Server-Client<\/figcaption><\/figure>\r\n<p>\r\nVery often, the client will send a request to a server, and the server will send back the information to the client. It is then the client&#8217;s job to present it to the user. This brings us to the front-end.\r\n<\/p>\r\n\r\n<h2>The Front-End trinity<\/h2>\r\n<p>\r\nSo what is the front-end? It is the client-facing code (hence &#8220;front&#8221;-end), is running on the client&#8217;s machine and is responsible for displaying content on the page. However, while the front-end IS running on the client&#8217;s machine, it is provided by the server. Nonetheless, the client can actually inspect it and modify it.\r\n<ul>\r\n  <li>Most modern browsers have an option called &#8220;developer console&#8221;, which can usually be accessed with the F12 key. It allows you to see and manipulate a lot of information on the page. It&#8217;s definitely worth looking into and experimenting with it!<\/li>\r\n  <li>The main objective of web-extensions is usually to inspect what is on a webpage and either modify it or keep track of things.<\/li>\r\n<\/ul>\r\n<\/p>\r\n<p>\r\nAs for the kind of code found on the front-end, it is usually a combination of three different categories:\r\n<ul>\r\n  <li>The Markup language, which is in charge of the content of the page itself. It contains the different elements, such as columns, tables, text, etc&#8230; The main language used here is usually HTML.<\/li>\r\n  <li>The Style Sheet language, which allows you to define the appearance of the page, such as font, color, spacing, ordering, layout, etc&#8230; The main language used here is usually CSS.<\/li>\r\n  <li>The Scripting language, which is a full-fledged programming language that allows you to program behavior, modify the page on the fly, react to user input, etc&#8230; It allows webpages to be dynamic. The main language used here is Javascript (Although PHP is still used by some big corporations).\r\n<\/ul>\r\n<\/p>\r\n<figure id=\"attachment_2304\" aria-describedby=\"caption-attachment-2304\" style=\"width: 660px\" class=\"wp-caption aligncenter\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/www.shawnmeanders.com\/blog\/wp-content\/uploads\/2024\/08\/front-end-trinity-1024x907.png\" alt=\"\" width=\"660\" height=\"585\" class=\"size-large wp-image-2304\" srcset=\"https:\/\/www.shawnmeanders.com\/blog\/wp-content\/uploads\/2024\/08\/front-end-trinity-1024x907.png 1024w, https:\/\/www.shawnmeanders.com\/blog\/wp-content\/uploads\/2024\/08\/front-end-trinity-300x266.png 300w, https:\/\/www.shawnmeanders.com\/blog\/wp-content\/uploads\/2024\/08\/front-end-trinity-768x681.png 768w, https:\/\/www.shawnmeanders.com\/blog\/wp-content\/uploads\/2024\/08\/front-end-trinity-250x222.png 250w, https:\/\/www.shawnmeanders.com\/blog\/wp-content\/uploads\/2024\/08\/front-end-trinity-550x487.png 550w, https:\/\/www.shawnmeanders.com\/blog\/wp-content\/uploads\/2024\/08\/front-end-trinity-800x709.png 800w, https:\/\/www.shawnmeanders.com\/blog\/wp-content\/uploads\/2024\/08\/front-end-trinity-203x180.png 203w, https:\/\/www.shawnmeanders.com\/blog\/wp-content\/uploads\/2024\/08\/front-end-trinity-339x300.png 339w, https:\/\/www.shawnmeanders.com\/blog\/wp-content\/uploads\/2024\/08\/front-end-trinity-564x500.png 564w, https:\/\/www.shawnmeanders.com\/blog\/wp-content\/uploads\/2024\/08\/front-end-trinity.png 1124w\" sizes=\"auto, (max-width: 660px) 100vw, 660px\" \/><figcaption id=\"caption-attachment-2304\" class=\"wp-caption-text\">Front-end Trinity<\/figcaption><\/figure>\r\n\r\n<p>\r\n<em>Note about the Scripting Language: most people will actually use a <a href=\"https:\/\/en.wikipedia.org\/wiki\/Software_framework\">Framework<\/a>, and there are many different Javascript Frameworks. The goal of a Framework is to simplify and mainstream the use of the scripting language, adding a lot of built-in functionality and libraries. Still, it&#8217;s possible to use Javascript without a framework, which is often called &#8220;Vanilla Javascript&#8221;.<\/em>\r\n<\/p>\r\n\r\n<h2>The Back-end<\/h2>\r\n<p>\r\nSo far, we&#8217;ve been talking about the front-end, and it might leave you wondering&#8230;if there&#8217;s a front-end, does that mean there&#8217;s also a back-end? Yes, there is: it&#8217;s the code running on the server. This includes, for example, the <a href=\"https:\/\/en.wikipedia.org\/wiki\/Database\">database<\/a> (where all the data is stored) and <a href=\"https:\/\/en.wikipedia.org\/wiki\/Web_API\">API-endpoints<\/a> that users connect to. The back-end, serving a different purpose, tends to be fairly different from the front-end, and is usually hidden from the user.\r\n<\/p>\r\n\r\n<h2>What&#8217;s Next?<\/h2>\r\n<p>\r\nThis is but a basic overview of the front-end to give you a bird&#8217;s eye view of what&#8217;s involved, a simple starting point, yet an important one for anyone interested in understanding webpages and how to program them. In the upcoming weeks, as I work on my <a href=\"https:\/\/www.shawnmeanders.com\/blog\/chinese-study-app-programming-project\/\">Chinese Study App project<\/a>, I plan to release a few more guides discussing some of the elements highlighted here in more detail.\r\n<\/p>\r\n","protected":false},"excerpt":{"rendered":"<p>This was written August 25, 2024. Introduction Ah, the web. It&#8217;s become almost ubiquitous nowadays. But although it used to be accessed mostly through browsers and webpages, it&#8217;s now often accessed directly through 1st party apps instead. Regardless, I think browsers and webpages still have a lot of value, and so does understanding them. For &hellip; <a href=\"https:\/\/www.shawnmeanders.com\/blog\/2024\/08\/25\/webpages-front-end-introduction\/\" class=\"more-link\">Continue reading <span class=\"screen-reader-text\">Webpages &#8211; Front-end introduction<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"bgseo_title":"","bgseo_description":"","bgseo_robots_index":"index","bgseo_robots_follow":"follow","footnotes":""},"categories":[11,14],"tags":[],"class_list":["post-2300","post","type-post","status-publish","format-standard","hentry","category-programming","category-tutorial"],"_links":{"self":[{"href":"https:\/\/www.shawnmeanders.com\/blog\/wp-json\/wp\/v2\/posts\/2300","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.shawnmeanders.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.shawnmeanders.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.shawnmeanders.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.shawnmeanders.com\/blog\/wp-json\/wp\/v2\/comments?post=2300"}],"version-history":[{"count":10,"href":"https:\/\/www.shawnmeanders.com\/blog\/wp-json\/wp\/v2\/posts\/2300\/revisions"}],"predecessor-version":[{"id":2347,"href":"https:\/\/www.shawnmeanders.com\/blog\/wp-json\/wp\/v2\/posts\/2300\/revisions\/2347"}],"wp:attachment":[{"href":"https:\/\/www.shawnmeanders.com\/blog\/wp-json\/wp\/v2\/media?parent=2300"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.shawnmeanders.com\/blog\/wp-json\/wp\/v2\/categories?post=2300"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.shawnmeanders.com\/blog\/wp-json\/wp\/v2\/tags?post=2300"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}