Embedding 3D XML Player in Web Browsers

This task shows you how to integrate 3D XML Player in a web browser.

This task includes the following subtasks:

Add 3D XML Player in an HTML Page

You can add a 3D XML Player in an HTML page.

  1. Drag and drop the .3dxml file into the Web browser or Create an HTML page.

  2. Add the following code in the body of your HTML page:

    <object type='application/x-3dxmlplugin' id='3DXMLPluginId'>
    <param name='DocumentFile'
    value='http://www.3DVIA.com/mymodel.3dxml'>
    </object>

Important: The parameter DocumentFile is used to specify the file to load in the 3D XML Player. In this example the web page will contain a 3D XML Player in embedded mode that will display the model named MyModel.3dxml. The parameter can specify an URL address, an absolute or relative path to a local file. DocumentFile can be empty, in this case an empty viewer will be displayed. In order to load data you will need to valuate the DocumentFile property (e.g. 3DXMLPluginId.DocumentFile='http://www.3DVIA.com/mymodel.3dxml').

Note:

  • On a 64-bit platform, .3dxml files can be displayed in the web browser for a 32-bit or 64-bit web browser.
  • When doing a drag and drop of a .3dxml file in IE 7 on Vista, the source location of the .3dxml file must be added to your trusted site.

Considerations

The following considerations should be taken into account:

  1. To access the 3D XML files displayed on your web site, a MIME type has to be configured on the web server for 3D XML. For this, you have to register on the server the .3dxml extension as "application/octet-stream" type.

  2. To detect 3D XML Player by script in a web page, you will need to add the following code:

    <HTML> 
    <BODY> 
    <SCRIPT LANGUAGE="Javascript"> 
    var playerInstalled = 0; 
    MSDetect = "false"; 
    if (navigator.mimeTypes && navigator.mimeTypes.length)
    
    { 
    x = navigator.mimeTypes['application/x-3dxmlplugin']; 
    if (x && x.enabledPlugin) 
    playerInstalled = 1; 
    } 
    else 
    { 
    MSDetect = "true"; 
    } 
    </SCRIPT> 
    <SCRIPT LANGUAGE="VBScript"> 
    on error resume next 
    If MSDetect = "true" Then 
    If NOT (IsObject(CreateObject("3DXMLPlugin"))) Then 
    playerInstalled = 0 
    Else 
    playerInstalled = 1 
    End If 
    End If 
    </SCRIPT> 
    <SCRIPT LANGUAGE="Javascript"> 
    if (playerInstalled == 0) 
    { 
    <!-- 3D XML Player is not installed - > 
    } 
    else 
    { 
    <!-- 3D XML Player is installed - >
    } 
    </SCRIPT> 
    </BODY> 
    </HTML>