Author |
|
gw1500se
Joined: 03 Dec 2014 Posts: 4
|
Posted: Sat 16 May '20 18:39 Post subject: Serving Embedded CSS and JS Files |
|
|
I am trying write a script using python 3 httpd server. Unfortunately the documentation to that is very poor and the python forum has not been much help. Since my question is really about how data is send to the client I hope I can get some help here.
I have no trouble serving out the main page. The problem is how to serve out the embedded css and/or js files. I get the request for the files but I think my problem is I need to server them out with different headers than the main page. When the browser requests a css file, what does it expect to see as far as headers are concerned to know this is not a new page but rather the file requested? How do I know the difference between requests for a regular html page and a css or js page? It is just the file type? TIA. |
|
Back to top |
|
James Blond Moderator
Joined: 19 Jan 2006 Posts: 7373 Location: Germany, Next to Hamburg
|
Posted: Sun 17 May '20 17:55 Post subject: |
|
|
You may search for
Quote: | phython set http header content type | on the web.
The header for javascript files and css files is different than html |
|
Back to top |
|
gw1500se
Joined: 03 Dec 2014 Posts: 4
|
Posted: Sun 17 May '20 18:38 Post subject: |
|
|
Thanks for the reply. You put me on the right track. |
|
Back to top |
|
dpat99
Joined: 15 May 2023 Posts: 5
|
Posted: Mon 22 May '23 10:09 Post subject: |
|
|
Is there anyway to automatically do this so we can save time? Currently it is with separate headers for CSS / JS right? |
|
Back to top |
|
James Blond Moderator
Joined: 19 Jan 2006 Posts: 7373 Location: Germany, Next to Hamburg
|
Posted: Wed 31 May '23 14:44 Post subject: |
|
|
dpat99 wrote: | Is there anyway to automatically do this so we can save time? Currently it is with separate headers for CSS / JS right? |
if your file has the correct file ending apache will send the correct header. It is only necessary for dynamic generated files. |
|
Back to top |
|