4 ms·
I have a hard time following this discussion and would be glad if someone could clarify a few aspects. 1. What is a "static client" in this context? From my un
by WA 14y ago
I have a hard time following this discussion and would be glad if someone could clarify a few aspects.
1. What is a "static client" in this context? From my understanding, a static client is a non-JS web browser that does one thing: render HTML code that is composed and served by the server.
2. People here talk about "(not) rendering HTML on the server". What's that supposed to be? I thought "rendering HTML" means that you take HTML and display it on a screen, which happens ALWAYS in the client and never on the server.
Anyone care to explain?
- abraininavat 14y agoI'm not an expert, so take this with a grain of salt. Hopefully someone corrects me if I'm wrong, but.. "Static client" here doesn't refer to the user's browser. It refers to a front-end that serves web requests. It serves them statically, in that every URL maps to a static HTML file (with embedded javascript). Once the user receives that static HTML browser with embedded javascript, this then becomes the client. The javascript (run from within the user's browser now) communicates with a back-end or server, which the article describes as a "RESTful JSON API". It fetches JSON documents and uses the results to render HTML. "Render" here means "turn the backend data into HTML output". This all is in contrast with a more common approach to dynamic web-pages, in that every URL request prompts a dynamic process on the server to do some logic (fetch data from a database often, and parse and interpret request parameters) to render HTML which is then sent back to the user. Hope that helps.
- gbog 14y ago1. A static client is an empty page with a big js blob. 2. it is about where the html is generated, either by js on client or by a script on the server.
- felideon 14y ago(OT: wow I just learned the hard way that in Chrome C-k kills the rest of input at point and cannot be undone. Also, C-a goes to the beginning of the input, rather than beginning of the line, so my C-a C-k habit made me lose my typed-up comment twice already.) Answering your second question sheds light on the first. A better term would be "generating" HTML on the server — the browser is obviously in charge of rendering. In Rails for example, you can have ruby code in an ERB template which the framework compiles to HTML. Hence, the HTML is "dynamically" generated (on every request). The opposite of dynamic is "static" where the HTML is either written by hand or generated just once (like Jekyll) rather than on every request. In either case, as a sibling comment mentions, an actual HTML file is served. However, thanks to JavaScript development maturing and JS engines getting faster, a lot of functionality that used to be done mainly server-side can be relegated to the client. I personally wouldn't use the phrase "static client" much, though. (Edit: Problem with "static client". To me a 'static' site means that it has no communication with a database, such as marketing sites or statically-generated blogs. 'Client' is too ambiguous as it's not necessarily a browser. curl is an HTTP client, for instance, and a JavaScript-driven "single-page application" would be pretty limited via curl.)
- WA 14y agoThank you all for your clarifications. That helped a lot for my understanding.
- papsosouid 14y ago>People here talk about "(not) rendering HTML on the server" I think I make that mistake fairly often. We don't actually mean rendering when we say that, sorry for the confusion. We actually mean the generation of html from whatever data we're displaying. So a server side template engine sends already generated html to the client, a client side template engine just gets the data from the server, and then generates the html using javascript.