Hello all,
I was experimenting with http content negotiation and I was having some issues.
When I run an if-statement that prints if it supports it or not (I am checking for svg support)
Here is the code:
<!Doctype html>
<html lang="en">
<head>
<meta charset="utf-8" />
<title>Content Negotiation</title>
</head>
<body>
<?php
if (stristr($_SERVER["HTTP_ACCEPT"], "image/xml+svg")) {
echo "I support SVG as a css background-image!";
}
else{
echo "I don't support SVG as a css background-image!";
}
?>
</body>
</html>
But, here is my problem: browsers that do support svg images/documents as a background image via css, are saying that they do not accept this header :mad:
And I doubled check this by explicitly defining an svg image/document as a background-image of the body and they accepted the image, but not the header…?
For example, in chrome, it supports the explicit definition, but not the above code.
Am I looking for the support of the wrong mime type? That might be why its not accepting the header because the header I am checking for isn’t the right one (for support for svg images as a background-image)?
Does anyone have any ideas on why this isn’t working. Am I writing the condition in the if-statement right or is it something else?
I hope to hear from you soon and Please let me know if you have any Questions, Comments, Concerns, or Solutions please let me know
Thanks in Advance & Best Regards,
Team 1504