SVG to PNG fallback for Images

Simon Shahriveri 5th of February 2013

if (!Modernizr.svg) {
    $('img[src$=".svg"]').each(function()
    {
        $(this).attr('src', $(this).attr('src').replace('.svg', '.png'));
    });
}
1,887
Views
0
Comments
22
Downloads
Comments
Only Code Pad members can post comments!

Want to join Code Pad Request An Invite
    No Comments Posted

Creative Market - Fonts, icons,
graphics, website themes & more..

Snippet Details

  • Status: Public
  • Description: A Modernizr 'If' statement for finding all inline svg images and replacing them with PNG's for legacy browsers.
  • Saved by: Simon Shahriveri
  • Type: jQuery
  • Date: 5th February 2013
  • Characters: 168
  • Views: 1,887
  • Likes: 3
  • Downloads: 22 (SVGtoPNGfallbackforImages.txt)
Keyboard Shortcuts

DDownload

TTweet

FFull View

Next Snippet

Previous Snippet