So according to docs I've read, a webpage written in html code which includes script src="some_JavaScript_file.js is always a dynamic page even though the embedded JavaScript only has const sum=3+5 because no matter how simple it is, as long as there's even a tiny amount of backend involved, that webpage is definitely a dynamic webpage. so with that premise(please confirm that the premise I wrote is actually correct), my question is how does it make sense that Firebase claims it runs index.html sitting in Public folder ONLY when it's running a static webpage even though if that index.html file includes script src="some_JavaScript_file.js, it's a dynamic webpage?
Asked
Active
Viewed 484 times
1 Answers
0
Firebase Hosting doesn't interpret the content you host on it in any way. So if there's JavaScript in any of your files, Firebase doesn't execute that JavaScript code on its servers. Same for any other code: Firebase will serve the code as text (or whatever other format you stored it in) to clients that request it.
If your pages contain JavaScript that you want to run in the client's browser, that is precisely what you want. So you can serve a web site that contains client-side JavaScript on Firebase Hosting.
If you have any code that you want to run server-side you will have to look beyond Firebase Hosting. Nowadays you can stay within Google's infrastructure by integrating Firebase Hosting with Cloud Functions or Cloud Run.

Frank van Puffelen
- 565,676
- 79
- 828
- 807
-
I don't think my question was addressed. All I wanna know is if an index.html file that embeds a JavaScript file is still static content because Firebase claims anything within the Public folder is static content. And my issue with that is because if an index.html file has , it means it's dynamic content so is it really static content? or is it dynamic content? – Mike Kim May 28 '19 at 03:03
-
It depends on definitions of static and dynamic, which are subjective and contextual. That's why I answered what Firebase hosting can and can't do. If your pages contain JavaScript that you want to run in the client's browser, you can serve them on Firebase Hosting. Give it a try! – Frank van Puffelen May 28 '19 at 04:05
-
yep. I have previous experience of running that and it worked great. It's just that I wasn't completely clear on technicality and definitions. So I take it that because static VS dynamic is contextual, I can say that IF there's an html file that embeds a JavaScripts file inside it, then I can still say that html file is static content and inside that static content which is the html file, there's dynamic content which is the JavaScript file embedded. Please let me know if I got anything wrong. – Mike Kim May 28 '19 at 06:24