2

I've created a basic web server for a school project, and it serves static content without a problem.

I thought of having the server parse all htm/html files for links to .js/.css/image files, and send these files to the client without these files being requested by the client later.

eg. The browser requests: index.htm

The server responds with intex.htm and image.jpg

I modified the server to send two distinct http responses for a "GET /index.html HTTP1.1" (one for the html page and one for the image), but the browser ended up requesting the image when it was good and ready. Is there any way to bypass this? (use a multipart response, perhaps)

Will these files be accepted by most browsers, or will they be rejected for security reasons?

1 Answer 1

1

I've found this document, but I've never tried to deal with it.

If your goal is to minimize requests, you can somehow modify your pages (javascripts and stylesheets may be easyly included right into your html, also you can even embed base64-encoded images usind data: URI scheme, like it's described here)

1
  • Almost every single webpage on the internet will have to be modified if the scripts and styles are to be included in the html. As for base-64 images, older versions of IE lack support and some may limit the size of inline base-64 data. Reverse AJAX also requires the whole of index.htm to be loaded before subsequent data exchange can take place.
    – Osiris
    Jun 27, 2011 at 10:53

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.