[Last Call] Learn how to a build a cloud-first strategyRegister Now

  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 4259
  • Last Modified:

Base64 Image not rendering in IE8

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.

Steve Krile
Steve Krile
  • 2
1 Solution
Steve KrileAuthor Commented:
Figured it out.  The problem is size:

From this :  http://en.wikipedia.org/wiki/Data_URI_scheme#Web_browser_support

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!
HainKurtSr. System AnalystCommented:
Steve KrileAuthor Commented:
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

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now