How to run Vizit Pro in an iframe

The Vizit viewer can run in an iframe inside another page. As of build 31537, we provide the following options for embedding:

  1. Pure HTML – an iframe with specific URL in SRC attribute.
  2. HTML with JavaScript – same as above, plus JavaScript settings to change the Vizit layout and toolbars.
  3. ASP.NET server-side control – same as above, but generates all scripts automatically.

Pure HTML solution

Include the following code on your page:

<iframe src="http://{server}/_layouts/Vizit/Viewer/Default.aspx?u={url}" id="demo" name="demo"> </iframe>

This will load the Vizit viewer into an iframe on the page. (See How do I point Vizit viewer to open specific documents KB article)

HTML with JavaScript

The pure HTML solution loads the Viewer with default configuration profile. You can choose alternative profile with the cfg argument (see How do I change toolbar contents and viewer layout KB article). Since profiles are just plain JavaScript files, you can also include all the settings in one page:

<script language="javascript" type="text/javascript"> document.ConfigureVizit = function() { return { ExplorerGrid: { enabled: false }, PropertyEditor: { enabled: false }, AnnotationTree: { enabled: false }, Toolbars: [] }; }; </script> <iframe src=".../Default.aspx?u={url}&cfg=js/profiles/IframeImport.js" id="demo" name="demo"> </iframe>

The script provides custom configuration for the Vizit viewer (no explorer grid, no properties editor, no annotations tree, no toolbars), which is used by the viewer running in the iframe. This is done by special script, js/profiles/IframeImport.js, which imports settings from the parent window and passes them to the Viewer. Please note that function is referenced as document.ConfigureVizit.

Normally you will have the outer document and iframe document running off the same server. In rare cases, however, the outer document can be provisioned from a different server, which is typical for Cross Site Scripting (XSS). This is known to introduce “access denied” errors, when a window from domain A attempts accessing contents of window from domain B. For more information, please refer to our knowledge base article on Changing Toolbars, Layout, and Behavior of Vizit Pro.

Have more questions? Submit a request


Article is closed for comments.
Powered by Zendesk