This is a quick entry to demonstrate the Apache webserver's content negotiation. This system allows browsers to specify their capabilities to the webserver, which then chooses the most suitable form of the requested URL for the browser. I've used this for a while (e.g. when I link to my CV, which is both an HTML file and a PDF), but I only noticed it in its full glory when I tested it as follows:
Next, I created a PNG image, and a text file, one named content-negotiation.png, the other content-negotiation.txt (working out which one I named which is left as an exercise for the reader). Next, I link to the root filename content-negotiation. Browsers that are capable of displaying the image should receive the PNG image, whereas text-only browsers should receive the text file. Try it in both!
Comments
Post new comment