Base64 Image not rendering in IE8

Posted on 2011-10-28
Last Modified: 2012-05-12
Very odd problem and I can't work out the cause.  

I have a method that creates and image of a .net Chart Object, converts it to a base64 string and spits it out to the browser (via a web service/JSON string).  Every thing was peachy until one of my testers started noticing that *some* graphs were not being rendered by IE.  

Here is the code that generates the Base64 string - please note that this is working just fine.  All *modern* browsers are consuming this just fine:

            Dim imageStream As New System.IO.MemoryStream()
            GraphObj.SaveImage(imageStream, ChartImageFormat.Png)
            result.ImageString = Convert.ToBase64String(imageStream.ToArray())

Open in new window

"result" is a generic List(of ) that contains a string object called ImageString.

I've attached an HTML that contains the resulting Base64 strings added to an img tag (<img src="data:image/png;base64,......").

If you open that file in IE9, FF, Chrome, and Safari, both of the images display.  IE8 chokes on the first one.  I'm in a corporate environment where IE8 is the forced standard.

Any insight would be greatly appreciated.

Question by:skrile
    LVL 16

    Accepted Solution

    Figured it out.  The problem is size:

    From this :

    Internet Explorer 8: Microsoft has limited its support to certain "non-navigable" content for security reasons, including concerns that JavaScript embedded in a data URI may not be interpretable by script filters such as those used by web-based email clients. Data URIs must be smaller than 32 KiB in Version 8.[3] Data URIs are supported only for the following elements and/or attributes...

    So.  Size matters.  Blah!
    LVL 51

    Expert Comment

    LVL 16

    Author Comment

    Thanks Hain, but that's not it.  As long as the file size is <32kb, they display just fine in all my IE8 test machines.  As soon as a user generates a "complicated" graph with lots of colors and such (and therefore file size > 32kb) it breaks.

    Featured Post

    Highfive Gives IT Their Time Back

    Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

    Join & Write a Comment

    #Citrix #Internet Explorer #Enterprise Mode #IE 11 #IE 8
    Several part series to implement Internet Explorer 11 Enterprise Mode
    This Micro Tutorial will demonstrate how to add subdomains to your content reports. This can be very importing in having a site with multiple subdomains.
    How to create a custom search shortcut to site-search Experts Exchange using Google in the Firefox browser. This eliminates the need to type out whenever you want to search the site. Launch your Bookmark Menu: Press 'Ctrl +…

    729 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    19 Experts available now in Live!

    Get 1:1 Help Now