php - Change file extension if browser is IE -


I'm looking for the best solution for dynamically converting some image extensions (.svg to .png) Only then the browser is IE.

I do not know what is the best solution:

  • Parsing HTML code with PHP
  • jQuery with something Use such as

    $ ("img.svg2png"). Attr ("src", ...);

  • Dealing with HTACAC and rewriting the rules

  • Other solutions?

Thank you!

You are not telling too many details about what you are doing, but mod_rewrite solution ( USER_AGENT is catching the variable and whether it is IE and internally mailing .png file) seems most beautiful to me, because it works without javascript, And you can keep the file extension. The .svg extension can not be correct unless the correct content type header is sent.


Comments