cross browser stuff, convert to base64