.NET WebBrowser control with Adobe SVG Viewer
Posted
on Stack Overflow
See other posts from Stack Overflow
Published on 2009-01-07T18:07:49Z
Indexed on
2010/04/30
5:07 UTC
Read the original article
Hit count: 335
I'm having problems with SVG files loading in a .NET 2.0 WebBrowser control. If I create a new WinForms application project, drag a WebBrowser control and a button onto the Form1.cs design surface, and add a line to the button's on-click handler to set the Url property of the WebBrowser control to an SVG file, I get two IE script errors at runtime (as in, the dialog you get when there is a Javascript problem). The only line of code I'm writing is therefore:
webBrowser1.Url = new Uri(@"http://wiki.allegro.cc/pub/f/fb/Grozilla.svg");
This SVG file loads fine if I browse directly to the link with IE; the errors I get via my test app are:
line 2, char 1, error: Invalid character, followed by line 1, char 1, error: Object expected
(assuming I answer yes to the prompt to 'continue running scripts on this page').
I'm using IE 7.0.5730.13, Adobe SVG Viewer 3.03 build 94, Visual Studio 2008. Can anyone replicate this? Has anyone seen it/got any idea how to fix it?
(edit: previously setting the URL in the constructor for the purposes of the example, but this raised the question of whether or not the control had finished initialising, so have changed the example to use a button - the problem still occurs. This bug originally appeared in production code so the example program I wrote was an attempt to isolate the issue and reproduce it as simply as possible.)
(edit 2: having tested on several different machines, this problems seems to be related to IE7 - run IE6, and everything works fine.)
© Stack Overflow or respective owner