I came across an issue recently with Visio’s Save As Web output and IE8. Basically a JavaScript function, which had worked quite happily in IE6 and 7, now throws an error as the main page loads.
I believe this issue will be addressed in the next Office 2007 SP2, coming soon, but until then and for any legacy sites there’s a fairly quick fix…
Background
Visio’s Save As Web output contains, amongst other things, a method to parse parameters contained in the URL. This enables you to add specific zoom, page index, shape focus and search settings in the following format:
http://www.domain.com/VisDiagram.htm?page=1&zoom=200
The function responsible for extracting the parameters is called ParseParams and it’s this function that falls over when passed an empty string.
Workaround
There are two options here, to fix the problem – one is to ensure the function isn’t called in the first place (probably the simplest fix if you never intend to use URL parameters), and two, to deal with the empty string issue inside the function itself.
Option 1 – Stop calling the function
- Open the main .htm page that Visio generates in a text editor, such as Notepad, and search for var gParams = ParseParams (location.search);
- Replace this line with var gParams = “”;
- Save the file and close.
Option 2 – Fix the function
- Open the main .htm page that Visio generates in a text editor, such as Notepad, and search for function ParseParams (strRawParams)
- Add the two lines highlighted in the image below or just replace the entire function with the this code.
While this is a bit of a nuisance to have to change things, the benefits are a much improved JavaScript engine in IE8. I’ve certainly seen a really noticeable difference in performance on JavaScript heavy sites such as Netvibes.com for example.
If you're interested in other js changes in IE8 then you might want to have a look at the JScript team blog.



Hi: I've used Option 2 to fix the difficulties I was having in IE7 and Visio 2003 ("losing" the Web links after allowing the scripts/ActiveX) - thanks so much. However I still want to use the Go To page/Search features (which show up in the left pane after the edits but are "empty"). Is there a way to edit the main_2.htm file to allow this?
Posted by: Heather A. | Thursday, 06 August 2009 at 10:54
Hello Heather,
The issue in this post really only effects IE8, so you shouldn't have a problem with IE7.
Regarding you question, I'm not clear on the problem. Are you saying that you've edited the (html) page and now you're not seeing the Go To Page and Search features at all? Can you see the Pan and Zoom widget?
A couple of other questions:
1) What are you primary and secondary output formats (eg VML and GIF)?
2) What are you using to edit the html?
Best regards
John
Posted by: John Goldsmith | Thursday, 06 August 2009 at 12:12
Thanks for your post - This has helped resolve the error I was having (I used option 2). My Visio Document was saved in 2003, but the tip still works!
Posted by: ElNumbre | Monday, 28 September 2009 at 11:40
Hi John,
Firstly, congrats on a great blog - this is my first post though I've learned a lot about Visio from it already.
My question relates to the "Save As Web Page" functionality. I've got a simple diagram linked to a database and when I save it as HTML, I would normally expect to be able to Ctrl-Click and see the object properties as well as search.
However, though this worked for me a while back on Visio 2003, I recently upgrade to Visio 2010 (as well as IE8 which is as likely to be part of the issue) and I can't get any interaction with the web page now (as though the JavaScript isn't working). If I publish this to a shared drive other colleagues, also using IE8, can use it fine.
I've read a number of similar blog and forum entries suggesting things like bad IE security patches (ActiveX kill bits) and IE security settings, but can't seem to get to the bottom of it.
Any ideas would be much appreciated...
Thanks,
Andrew
Posted by: Andrew | Thursday, 23 September 2010 at 05:57