// Detecting data URLs // data URI - MDN https://developer.mozilla.org/en-US/docs/data_URIs // The "data" URL scheme: http://tools.ietf.org/html/rfc2397 // Valid URL Characters: http://tools.ietf.org/html/rfc2396#section2 function isDataURL(s) { return !!s.match(isDataURL.regex); } isDataURL.regex = /^\s*data:([a-z]+\/[a-z]+(;[a-z\-]+\=[a-z\-]+)?)?(;base64)?,[a-z0-9\!\$\&\'\,\(\)\*\+\,\;\=\-\.\_\~\:\@\/\?\%\s]*\s*$/i;