Browser-Independent Example

www.altova.com Print this Topic Previous Page Up One Level Next page

Home >  Server Setup > HTML Page for Authentic Plug-in > Browser-Independent >

Browser-Independent Example

The HTML code below generates a page that has the following features:

 

It checks what browser is installed on the client (Internet Explorer, Firefox) and installs an Authentic Browser version for the detected browser type.
Furthermore, if the installed browser is Internet Explorer, then it checks whether the system is 32-bit or 64-bit, and then selects the correct .CAB file (for 32-bit or 64-bit Internet Explorer).
The Authentic Browser window within the page has a width that is 100% that of the browser window and 60% of its height.
Below the Authentic Browser window is a row of five buttons
The Start Editing button loads the Authentic View of OrgChart.xml, which is in the root directory of your server
The Find and Replace buttons pop up the Find and Replace dialogs respectively
The Save button saves changes to a file called SaveFile_OrgChart.xml located in the root directory of the server
The Test property button tests a simple property

 

When this HTML page is opened on the client, the user can start editing the XML file OrgChart.xml and save the edited file as SaveFile_OrgChart.xml.

 

You may wish to use this simple HTML page to test whether Authentic Browser functions properly. If you do so, be sure to use the IP Address and the correct path to the respective files in the URLs that locate the the XPI file, the xsd, xml, and sps files, and any other resource on the server. Note that case-sensitivity might be an issue with some servers, so if there is a problem locating a file, check the casing of filenames and of commands in the code. You can expand or modify this example to build more complex solutions using Authentic Browser.

 

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">

<html>

 <head>

         <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">

         <title>Orgchart.sps Scriptable Plug-in Test - browser independent</title>

         <script type="text/javascript">

                 <!--

                 function BtnOnSave() { objPlugIn.Save();}

                 

                 function InitAuthenticPluginPage( )

                 {

                 

                  var schema= document.getElementById('xsd');

                  var instance=document.getElementById('xml');

                  var design=document.getElementById('sps');

                  objPlugIn.XMLDataLoadObject.URL =instance.innerHTML;

                  objPlugIn.DesignDataLoadObject.URL = design.innerHTML;

                  objPlugIn.SchemaLoadObject.URL= schema.innerHTML;

                 // alert(schema.innerHTML+"  "+instance.innerHTML+" " +design.innerHTML);

                 

                 /*

                  var serverstr='your-server/';

                  var basedir='Authentic/';

                  objPlugIn.SchemaLoadObject.URL = 'http://' + serverstr + basedir + 'OrgChart.xsd';

                  objPlugIn.XMLDataLoadObject.URL = 'http://' + serverstr + basedir + 'OrgChart.xml' ;

                  objPlugIn.DesignDataLoadObject.URL = 'http://' + serverstr + basedir + 'OrgChart.sps';

                 */

                 

                  objPlugIn.StartEditing();

                 

                 

                 }

                 

                 function Unload()

                 {

                 

                 //-->

         </script>

 <style type="text/css">@page { margin-left:0.60in; margin-right:0.60in; margin-top:0.79in; margin-bottom:0.79in } @media         screen { br.altova-page-break { display: none; } } @media print { br.altova-page-break { page-break-before: always; } }

 </style>

 </head>

 

 <body id="bodyId" onunload="Unload()">

         <table border="1">

                 <tbody>

                         <tr><th><span>DesignLoadURL</span></th><td id="sps">http://your-server/Authentic/Orgchart.sps</td></tr>

                         <tr><th><span>SchemaLoadURL</span></th><td id="xsd">http://your-server/Authentic/Orgchart.xsd</td></tr>

                         <tr><th><span>XMLDataLoadURL</span></th><td id="xml">http://your-server/Authentic/Orgchart.xml</td></tr>

                         <tr><th><span>XMLDataSaveURL</span></th><td id="xmlsave">http://your-server/Authentic/SaveFile_OrgChart.xml</td></tr>

                 </tbody>

         </table>

         <center><h3><span>Authentic Platformindependent Plug-in Enterprise Edition</span></h3></center>

         <span>&nbsp;</span>

         <center>

         <script language="JavaScript" type="text/javascript">

                 // return true if the page loads in Firefox

                 function isFirefoxOnWindows()

                 {

                  return ((navigator.userAgent.indexOf('Firef') != -1) && (navigator.userAgent.indexOf('Win') != -1));

                 }

                 

                 // return true if the page loads in Internet Explorer

                 function isIEOnWindows()

                 {

                  return ((navigator.userAgent.indexOf('MSIE') != -1) && (navigator.userAgent.indexOf('Win') != -1))

                 }

                 

                 //return true if Browser is 64bit

                 function is64bitBrowser()

                 {

                  return ((navigator.userAgent.indexOf('Win64') != -1)&& (navigator.userAgent.indexOf('x64') != -1))

                 }

                 

                 //return Codebase for 32 bit  or 64 bit

                 function getCodeBase()

                 {

                   if ( is64bitBrowser() ){

                         return('CodeBase="http://your-server/AuthenticBrowserEdition_x64.CAB#Version=12,2,0,0" ')

                   }

                   else {

                         return('CodeBase="http://your-server/AuthenticBrowserEdition.CAB#Version=12,2,0,0" ')

                   }

                 }

                 

                 // Create the plugin object instance, according to the browser loading the page

                 // -Firefox uses EMBED tag for embeding plugins and supports PLUGINSPAGE

                 // attribute to redirect to an installation file if the plugin is not

                 // currently installed;

                 // -IE uses <OBJECT> tag for embeding plugins and supports CODEBASE attribute

                 // to indicate a .cab file for the installation if the plugin is not

                 // currently installed

                 

                 function createObject( codebase, clsid)

                 {

                  if ( isFirefoxOnWindows() )

                  {

                  document.write ( '<embed ' +

                  'id="objPlugIn" ' +

                  'type="application/x-authentic-scriptable-plugin" ' +

                  'width="100%" ' +

                  'height="60%" ' + 'PLUGINSPAGE="http://your-server/Authentic/AuthenticFirefoxPlugin_trusted.xpi" ' +

                    'SaveButtonAutoEnable="true" ' +

                    'EntryHelpersEnabled="true" ' +

                    'LicServer="your-server" ' +

                    'LicCompany="Altova" ' +

                    'LicKey="XXXXXXXXXX" ' +

                    'XMLDataSaveUrl="http://your-server/Authentic/SaveFile_OrgChart.xml"> ' +

                  '<\/embed>' );

                  }

                   else if ( isIEOnWindows() )

                  {

                  document.write ( '<OBJECT ' +

                         'id="objPlugIn" ' +

                         getCodeBase() +

                         'Classid="clsid:B4628728-E3F0-44a2-BEC8-F838555AE780" ' +

                         'width="100%" ' +

                         'height="60%" ' +

                         '>' +

                         '<PARAM NAME="XMLDataSaveUrl" VALUE="http://your-server/Authentic/SaveFile_OrgChart.xml"> ' +

                         '<PARAM NAME="EntryHelpersEnabled" VALUE="TRUE"> ' + 

                         '<PARAM NAME="SaveButtonAutoEnable" VALUE="TRUE"> ' +

                         '<PARAM NAME="LicServer" VALUE="your-server"> ' +

                         '<PARAM NAME="LicCompany" VALUE="Altova"> ' +

                         '<PARAM NAME="LicKey" VALUE="XXXXXXXXXX"> ' +

                         '<\/OBJECT>');

                 }

                 }

                 

                 createObject();

                 // after running createObject the plugin object exists. Initialize the javascript variable to be used in the scripts

                 var objPlugIn = document.getElementById('objPlugIn'); 

         </script>

                 

                 <br><br>

                 <button onclick="objPlugIn.StartEditing()"><span>Start Editing</span></button>

                 <button onclick="objPlugIn.FindDialog()"><span>Find</span></button>

                 <button onclick="objPlugIn.ReplaceDialog();"><span>Replace</span></button>

                 <button onclick="BtnOnSave()"><span>Save</span></button>

                 <button onclick="alert ( objPlugIn.IsRowInsertEnabled );"><span>Test</span><br></button>

                 </center>

                 

         <script language="javascript" type="text/javascript">

                         // event subscription if running on Firefox

                          if ( isFirefoxOnWindows() )

                          {

                          objPlugIn.addEventListener("ControlInitialized", InitAuthenticPluginPage, false);

                          }

         </script>

                 

         <script event="ControlInitialized" for="objPlugIn" language="javascript" type="text/javascript">

                         // event subscription if running on Internet Explorer

                          if ( isIEOnWindows() )

                          {

                          InitAuthenticPluginPage();

                          //if ( isIEx64OnWindows() ) alert("IE x64");

                          }

         </script>

                 

 </body>

</html>

 

 

Note:The script above contains license information for activating Authentic Browser Enterprise Edition.

 


© 2019 Altova GmbH