In an earlier blog posting, I shared information from the Autodesk DWF Viewer help file on how to embed a DWF file in an HTML page. That post covered the parts of an HTML <object> tag and what those parts mean. This post covers an updated way to embed DWF files in an HTML page to avoid the "extra step" that people who view your DWF files now have to execute.
Microsoft is currently involved in a patent infringement lawsuit with the Eolas (Embedded objects linked across systems) spin off of the University of California. The case involves viewing dynamic content on the web and impacts how ActiveX Controls, such as the Autodesk DWF Viewer, get invoked. Perhaps in response to the litigation, Microsoft has released a "security patch" that requires the user to "press SPACEBAR or ENTER to activate and use this control." Jimmy Bergmark has a nice summary of the problem and a test page to determine if you have applied this patch. This extra step has negative implications for applications that use DWF files within Internet Explorer such as the Autodesk People Finder.
The Autodesk DWF Viewer actually consists of several ActiveX Controls:
The Autodesk DWF Viewer ActiveX Control is the top or "outermost control" and is invoked by the end user via an <object> tag in his HTML page. The secondary or "inner controls" are invoked by the Autodesk DWF Viewer control on behalf of the user. The EPlot control is activated for when reading 2D data from a DWF file. The EModel control is activated when reading 3D data from a DWF file. The EMap control is activated when reading dynamic data from the Autodesk MapGuide solution. There are several other smaller controls for various User Interface (UI) elements.
Depending on the DWF usage, its is possible for users to get a request to press SPACEBAR or ENTER for each control. What a pain. Microsoft refers to this request as a "gold bar." From the Microsoft web site: "When users encounter an ActiveX control for the first time, they will see a gold bar asking if they want to use the control. Users can then choose to allow or prevent running the control." The gold bar applies to Internet Explorer 7 as well as the patched version of Internet Explorer 6.
As we move forward, Autodesk has worked with Microsoft to eliminate the need for the user to encounter a gold bar when the EPlot, EModel, or EMap controls are loaded. Software developer, Walt Welton-Lair, notes that Autodesk DWF Viewer 7.0 loads the inner controls via external script files - one of Microsoft's recommended work arounds. This strategy has also been applied to the controls for the UI elements. So all that leaves for the end user is the invocation of the Autodesk DWF Viewer control itself.
To eliminate the gold bar when the Autodesk DWF Viewer control is loaded, Autodesk discussion group participant, Steve Segarra, provided sample HTML which uses JavaScript to load the DWF file via an <object> tag.
dwf_original.html:
<html>
<head>
<meta http-equiv="Content-Type" content="text/html;
charset=windows-1252">
<title>Traditional Means of Embedding DWF Viewer</title>
</head>
<body>
<object id="objViewer"
codebase="http://www.autodesk.com/global/dwfviewer/
installer/DwfViewerSetup.cab#version=7,0,0,928"
width="200" height="200"
classid="clsid:A662DA7E-CCB7-4743-B71A-D817F6D575DF">
<param NAME="src" VALUE="my.dwf">
</object>
</body>
</html>
dwf_workaround.html:
<html>
<head>
<meta http-equiv="Content-Type" content="text/html;
charset=windows-1252">
<title>Means of Loading DWF Viewer with Workaround for
MS April 11 Security Update</title>
<script language="JavaScript" src="dwf_workaround.js">
</script>
</head>
<body onload="load()">
<div id="embedControlLocation">
</div>
</body>
</html>
dwf_workaround.js:
function load() {
var DivID = document.getElementById("embedControlLocation");
var s = '<object id="objViewer" width="200" height="200">';
s = s + '<param name="src" VALUE="my.dwf">';
s = s + '</object>';
DivID.innerHTML = s;
}
The codebase and classid portions of the <object> tag are actually specified in the onload function. They have been omitted here due to blog column width limitations. You can download a zip file with Steve's sample DWF file and complete HTML pages. Download DWFViewerActiveXApril11SecurityUpdateProblemExample.zip (28KB).
This approach applies to use of DWF viewers with Internet Explorer 6. Although this approach also applies to Internet Explorer 7, Internet Explorer 7 is not supported by: the "as originally released" Autodesk DWF Viewer 6.5, Autodesk DWF Viewer 7.0, Autodesk DWF Composer R2, or Autodesk Design Review 2007. There is more work to do to support Internet Explorer 7. A hotfix is available for Autodesk DWF Viewer 7.0 and Autodesk Design Review 2007.