Live data from Hacker News

Entire website in a single HTML file

css-tricks.com

261–270 of 333 posts

Re: Entire website in a single HTML file

#261
post #119
post #101

Earlier quoted context omitted.

nice. most sites that use javascript don't need to... https://i.imgur.com/qaJYWit.png

I’m not sure that Google Maps is the best example of something that should work well without JS.

True, but even Google Maps could work without Javascript... It may not be as easy to use without it though.

Re: Entire website in a single HTML file

#262

Earlier quoted context omitted.

Easy solution. Use progressive compression for images and set loading="lazy" https://developer.mozilla.org/en-US/docs/Web/Performance/Laz...

loading="lazy" is for images that are NOT embedded in the same file. So we either have entire site in a single HTML file or we have scalability for large stes. There's no solution that gives us both.

It depends on what your goal is. If you just want to make a single request to the web server, than loading="lazy" will not work as you said. (Technically speaking, TCP is sending multiple packages anyway resulting in higher latency, so not sure if that is a great goal.)

But if you just want to be able to save the entire website with Ctrl + S, then it works fine.

As an aside, loading="lazy" is the way in which images are embedded in the website from TFA https://i.imgur.com/wIkaE5g.png which was the reason why I mentioned it, although it certainly does not fit all possible use cases.

Re: Entire website in a single HTML file

#264

Earlier quoted context omitted.

Not to get too dramatic about this, but if you're that scared of any JS, why are you using the internet?

You're making vague gestures about something that is a specific issue these days. JS delivers all kinds of straight up garbage, some of it meant to do very ugly things, it can be turned off, tada, I'm still on the internet. If people (like me) want to offer resources requiring none of that, why not encourage them, insofar as it makes the internet more efficient, a more helpful resource, and just way cooler in terms o…

This is an unusually defensive response. There's a big gap between "all kinds of straight up garbage, some of it meant to do very ugly things" and the tiny amount of JS that would replace what this does. This doesn't even enable any interesting functionality. You could simply put multiple html files on the same web server rather than putting everything into one file. The visitor to the website would not know the difference (a point made in the linked article).

Re: Entire website in a single HTML file

#265
post #247

It is kind of ironic that 20 years later this needs to be re-discovered.

This was absolutely not possible 20 years ago. The only pseudoclasses available at that point were the anchor pseudoclasses and :first-line/:first-letter.[1] What's being shown off here is not having a single page of a website in just HTML/CSS, but having all pages. [1] https://www.w3.org/TR/REC-CSS1/#pseudo-classes-and-pseudo-el...

Having an entire Website in a single HTML page was definitely possible.

Re: Entire website in a single HTML file

#266

Earlier quoted context omitted.

If only the Web had a way to make text clickable withtout showing the whole target URL.

I find inline links incredibly disruptive to my reading flow, the change in color makes my eyes start jumping around in the text. Wikipedia especially is absolutely hopeless, to the point where I've built a mirror that removes all inline links. (A page looks like this: https://encyclopedia.marginalia.nu/wiki/Hyperlink )

Looks good. A bit out of date though

Re: Entire website in a single HTML file

#267
post #35

Earlier quoted context omitted.

It is a limitation. Anyone who's ever tried to read a PDF journal article on their phone has experienced it. (and don't even get me started on Unicode copy/paste...) HTML can be styled in a fixed layout if desired, and reflowed by a reader mode if needed. PDF can't be styled in a responsive way, and there's no (easily accessible) reader mode equivalent for PDFs. HTML is a far better document format than PDF.

> there's no (easily accessible) reader mode equivalent for PDFs. It’s called Liquid Mode in Reader, and it is, in fact, easily accessible. > HTML is a far better document format than PDF. HTML is better for some things, PDF for others. That's why PDF is widely used on the web when HTML is available.

Liquid mode only works we for a subset of PDF files. And sometimes it doesn't work at all.

Re: Entire website in a single HTML file

#268
post #265

Earlier quoted context omitted.

This was absolutely not possible 20 years ago. The only pseudoclasses available at that point were the anchor pseudoclasses and :first-line/:first-letter.[1] What's being shown off here is not having a single page of a website in just HTML/CSS, but having all pages. [1] https://www.w3.org/TR/REC-CSS1/#pseudo-classes-and-pseudo-el...

Having an entire Website in a single HTML page was definitely possible.

Not if you wanted multiple pages without Javascript it wasn't. Which is what's interesting about the site being described, although the article does a weak job explaining it.

Re: Entire website in a single HTML file

#269

What's old is new again! Chris Coyer (the owner of CSS-Tricks) made a site using a similar trick in 2010 and there is a screencast of the technique on the same site as the linked article[0]. He did use jQuery to hide and show sections, but I imagine you could even implement a lot of the animations from back then as CSS these days. 0: https://css-tricks.com/video-screencasts/84-site-walkthrough...

Using jquery to hide and show sections is... not like OP at all. The whole point in OP is doing this without JS.

The code layout is so similar that these techniques are surely cousins (same ugly url and all). The only difference is the :target trick.

Further, the no-js portion isn’t even the main idea. “Entire website in a single file” is.

Re: Entire website in a single HTML file

#270

Earlier quoted context omitted.

Building a website without JS is not hard.

May I ask how to create a Mathematics Stack Exchange clone without JS?

In the past Latex symbols were rendered on server as an image.

It was not pretty but it works virtually anywhere.

Post reply on HN