Search code examples
javascripthtmlasp.netsilverlightvisio

silverlight content not working in iframe


I have an iframe inside an ASPX page like so:

<iframe id="mapFrame" name="mapFrame" src="project/visioMap.htm" frameborder="0" width="100%" height="900px" runat="server" />

The project directory holds Web page content exported by Visio. I want to embed this content into the .NET Website without altering any of the content exported by Visio (ie. *.htm, *.js, *.xaml). This is why I am trying to embed using the iframe tag.

However, when the page is loading, it crashes with the error:

TypeError: parent.parent.FindShapeXML is not a function
var shapeNode = parent.parent.FindShapeXML (pageID, shapeID); // in a *.js file

This error is in a *.js file exported by Visio, but like I said, I don't want to edit any of the files exported by Visio. If I just open visioMap.htm, everything works fine, so an iframe pointing to it should work fine by default.

Apparently, parent.parent has a different meaning when I open visioMap.htm (which has a with 2 frame) directly in the browser, and when I open visioMap.htm indirectly in the browser via an iframe.


Solution

  • Inside Visio "Save as Web" settings dialog has an option "Host in Web page".

    enter image description here

    By default, its value is "None". You can select here a web page, into which you would like to embed published content. Then it will be placed into <iframe> on this page. Alternatively, select "Basic" to have basic web page generated with <iframe> in it holding published content. This page HTML is as follows:

    <html>
        <head>
            <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
            <title></title>
        </head>
        <iframe src="[Your visio file name]_main_2.htm" width="100%" height="100%" frameborder="1" scrolling="auto">
            <!-- No iframesupport --> 
        </iframe>
    </html>
    

    You can use this page directly or point your <iframe> to "[Your visio file name]_main_2.htm" referenced on this page.