Live data from Hacker News

Password protect a static HTML page

github.com

41–50 of 294 posts

Re: Password protect a static HTML page

#41

Earlier quoted context omitted.

That's exactly what I said. It doesn't matter if I wrote the HTML by hand or I had a perl, or bash, or compiled c program make it. It's just an HTML file.

Lol no. If you HTML is generated, it's by definition not static anymore. Otherwise, all of the React server side rendering is static HTML.

Oh, so when I make an .html file in Dreamweaver WYSIWYG HTML editor and save the .html file to my websever ~/www/ dir it is automatically not a static page anymore because I used a program to generate it? This is a very wild and weird interpretation of 'static site' that does not fit with existing usage.

Re: Password protect a static HTML page

#42

Earlier quoted context omitted.

That's exactly what I said. It doesn't matter if I wrote the HTML by hand or I had a perl, or bash, or compiled c program make it. It's just an HTML file.

Lol no. If you HTML is generated, it's by definition not static anymore. Otherwise, all of the React server side rendering is static HTML.

No, because React is dynamically generating the HTML on the fly.

If you pre-compile the HTML using something like Jekyll, so that the webserver is just serving HTML files without any dynamic/on-the-fly processing at request time, then it's considered static.

Re: Password protect a static HTML page

#43
post #11

Earlier quoted context omitted.

> If you have to run javascript it is not a static page anymore. I've seen a lot of this particularly weird overloading of "static HTML" lately. Static HTML, or static webpage, is meant to describe the experience from the person who is trying to look at the page. It does not describe the experience of the dev. I don't think this has been the common meaning of "static page" for at least 10 years. From Wikipedia [0]: >…

>A static web page (sometimes called a flat page or a stationary page) is a web page that is delivered to the user's web browser exactly as stored" Right. "exactly as stored" It doesn't matter who or what wrote the HTML. I could do it by hand or maybe use a WYSIWYG editor to make it or maybe it's generated by a script. The point is that there's an html file sitting on disk and the server delivers it without modificat…

>>A static web page (sometimes called a flat page or a stationary page) is a web page that is delivered to the user's web browser exactly as stored"

>Right. "exactly as stored" It doesn't matter who or what wrote the HTML. I could do it by hand or maybe use a WYSIWYG editor to make it or maybe it's generated by a script.

Yes, agree.

>The point is that there's an html file sitting on disk and the server delivers it without modification and it's viewable in the browser as it.

No, I don't think that's the widely understood interpretation of "static web page."

Even the definition you agree with just says the file is delivered as-is. It says nothing about how the browser renders the page.

Re: Password protect a static HTML page

#44
post #3

If you have to run javascript it is not a static page anymore. I've seen a lot of this particularly weird overloading of "static HTML" lately. Static HTML, or static webpage, is meant to describe the experience from the person who is trying to look at the page. It does not describe the experience of the dev. Using a dynamic script or application to generate a static html page that requires no JS execution is a static…

> If you have to run javascript it is not a static page anymore

I understand static pages as files sent to a browser without having to be generated server-side.

Re: Password protect a static HTML page

#45
post #13

Earlier quoted context omitted.

How do you use that on something like GitHub pages?

Turns out when you give up the work of hosting your up stuff, you also give up some of the benefits from doing so.

Which is why a project that returns some of those benefits is genuinely cool and useful.

Re: Password protect a static HTML page

#46

Earlier quoted context omitted.

I think your definition of a static web page is different from the common one? In my head, a static page is something that's served verbatim, without some backend generating it or inserting things into a template. Wikipedia seems to agree with that view: https://en.wikipedia.org/wiki/Static_web_page

That's exactly what I said. It doesn't matter if I wrote the HTML by hand or I had a perl, or bash, or compiled c program make it. It's just an HTML file.

It can be html, css, javascript, whatever.

'Static' means it's only made of static files that can be served by just a vanilla Web server (i.e. just by serving static files).

Re: Password protect a static HTML page

#47
I'm not a cryptographer, but I'm pretty sure that CBC (https://github.com/robinmoisson/staticrypt/blob/main/lib/cry...) should be replaced with GCM (https://developer.mozilla.org/en-US/docs/Web/API/SubtleCrypt...) since this is not a stream.

https://security.stackexchange.com/questions/184305/why-woul...

(also, use the built-in WebCrypto API instead of the crypto-js package)

Re: Password protect a static HTML page

#49

Earlier quoted context omitted.

I think your definition of a static web page is different from the common one? In my head, a static page is something that's served verbatim, without some backend generating it or inserting things into a template. Wikipedia seems to agree with that view: https://en.wikipedia.org/wiki/Static_web_page

That's exactly what I said. It doesn't matter if I wrote the HTML by hand or I had a perl, or bash, or compiled c program make it. It's just an HTML file.

HTML includes the content of style and script elements (among many others) and the results of whatever they do.

The combination of all of these direct a browser in how to render a page.

Traditionally, a static site or static page is one whose data can be delivered to the client directly as stored, with no server-side alterations or generation.

This is/was a meaningful distinction because a server that can stream stored data is fundamentally much simpler than one that executes programs. Such a server can run in different contexts, be optimized in different ways, and satisfies constraints that allow further optimizations downstream.

Re: Password protect a static HTML page

#50

Should have used the WebCrypto API instead of the crypto-js npm package. https://developer.mozilla.org/en-US/docs/Web/API/Web_Crypto_...

What is the major difference? Isn't crypto-js still secure?

One is a Javascript package, the other is a browser library following a spec that is implemented by all the major browser companies.

Web Crypto is faster and has many more devs working in the different implementations between all the companies and doesn't require any includes.

Post reply on HN