Static versus Dynamic Web Pages

While browsing around the web, there’s no doubt you should have seen the terms such as ‘static sites’ and ‘static hosting’. Especially if you are someone who has been practicing web development. Indeed such terms sound simple and straightforward to anyone, but to be honest I did find those terms confusing at times before deciding I should put some effort to do my research so that it will help with clearing out my doubts. I was able to come up with some nice definitions and references which made things pretty clear after all. If you were also confused by these terms, this is the time to clear that up by reading this post.

One definition I’ve found via Google puts it like this: “simply put, static web hosting supports fixed-content, HTML-based websites that display the same information to all visitors. When a user’s web browser retrieves a static website from a static web hosting server, the entire page is already constructed in HTML files (along with possibly CSS and JavaScript)”

Another definition said: “static means that it is not generated on the server. the HTML, CSS, javascript is not generated dynamically. It’s already there on the server as it is. It’s hosted on the server. it’s lying there on the server in the version we as a user receive it. the source code is pre-built. it doesn’t change based on the requests.”

Well, those two definitions alone say it all, aren’t they? Static hosting is the service that enables hosting/serving static web pages. Static web pages are the fixed HTML pages that serve the same contents on every request it receives. They don’t change their contents dynamically.

To better understand the difference between a static page versus a dynamic page, let’s have a look at the below two example pages:

  1. Click here to open a static page
  2. Click here to open a dynamic page with a random joke each time you reload the page

Try reloading the static page several times. You should see there are no changes on that page during subsequent requests. However, you should see how content gets changed on the second page whenever you reload it.

I believe now you should get it. Plain and simple.

Besides, you may also refer to some of the below references for more understanding if you wish.

Static Web Hosting Providers

The below article attempts to provide a brief introduction to several well-known static hosting providers.

https://geekflare.com/best-static-site-hosting-platform/

By going through each of those providers mentioned in that list, I’ve come to an understanding that those providers who offer static hosting don’t support running server-side languages or database systems. For example, executing back-end code such as PHP, NodeJS, Ruby, etc., along with database queries not possible with such hosts. The reason is that the static web pages are not able to utilize such services. As you should already know, server-side languages such as PHP, NodeJS, and database systems such as MySQL, Oracle are used to store, process, and generate dynamic contents. The end-result of dynamic content generation is still an HTML page that is viewable on the browser. With static pages, you have already decided what contents you are going to show to the visitor. As the content remains unchanged, there’s no need to offer technologies that support generating dynamic content. That’s the reason those hosting providers only support hosting static content (pages and other static-assets such as CSS, javascript, and images).

Finally, I wanna emphasize that in this post, the use of the term ‘dynamic’ is meant to explain the assembly of a web page (contents/layout) that happens in the server. Not to present how a page behaves once loaded in the web browser (the client-side). That behavior should be identified as the interactivity of the page instead of calling as dynamic. Once loaded, a static web page can behave interactively by allowing its user to interact with it in numerous ways. That interactivity is achieved by using client-side scripting such as Javascript, and it is different from the dynamic processing that happens while generating the page on the server. Those are two different scenarios.

Bye for now! 👋👋👋

Was this helpful?
+1
0
+1
0
+1
0
+1
0
+1
0
+1
0
+1
0