LEADTOOLS JavaScript (Leadtools)

LTHelper Object

Show in webframe
Example 
Members 
Represents a helper class used by the various LEADTOOLS components to detect the current browser and operating system.
Syntax
function Leadtools.LTHelper() 
Remarks

LTHelper is used by the various LEADTOOLS components to detect the current browser and operating system. The capabilities and support of the various combinations are used to optimize the operation of the component.

This class is initialized automatically when the application starts. You can use the values of the properties in your own operations. However, do not change them.

Example

This example will show the various LTHelper's properties for the current browser.

Copy and paste this example into your favorite text editor and save it into a folder on your disk with any name such as Default.htm. Inside that folder, create a directory with the name "Scripts". Copy the required .js files in the example from "LEADTOOLS Installation Folder\Bin\JS" to "Scripts". Finally, open the HTML file in any browser that supports HTML 5.

<!DOCTYPE html>
<html>
<head>
   <title>Leadtools Examples</title>
   <meta http-equiv="X-UA-Compatible" content="IE=9" />
   <meta http-equiv="content-type" content="text/html; charset=utf-8" />
   <meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=0, minimum-scale=1.0, maximum-scale=1.0" />
   <meta name="apple-mobile-web-app-capable" content="yes" />
   <meta name="apple-mobile-web-app-status-bar-style" content="black-translucent" />
   <script type="text/javascript" src="Scripts/Leadtools.js"></script>
   <script type="text/javascript">
      (function () {
         DefaultPage = function DefaultPage() {
         }

         DefaultPage.prototype = {

            run: function SiteLibrary_DefaultPage$run() {
               this.RunExample();
            },

            dispose: function SiteLibrary_DefaultPage$dispose() {
            },

            RunExample: function() {
               var exampleButton = document.getElementById("LTHelperExampleButton");
               exampleButton.addEventListener("click", function() {
                  var text = "";

                  // Show the Operating System
                  switch (lt.LTHelper.OS) {
                     case lt.LTOS.windows:
                        text += "OS: Windows";
                        break;
                     case lt.LTOS.mac:
                        text += "OS: Mac";
                        break;
                    case lt.LTOS.iOS:
                        text += "OS: iOS";
                        break;
                    case lt.LTOS.android:
                        text += "OS: Android";
                        break;
                    case lt.LTOS.linux:
                        text += "OS: Linux";
                        break;
                    case lt.LTOS.blackberry:
                        text += "OS: Blackberry";
                        break;
                    case lt.LTOS.windows7:
                        text += "OS: Windows7";
                        break;
                    case lt.LTOS.windows8:
                        text += "OS: Windows8";
                        break;
                    case lt.LTOS.unknown:
                    default:
                        text += "OS: Unknown";
                        break;
                  }
                  text += "\r\n";

                  // Show the Device
                  switch (lt.LTHelper.device) {
                     case lt.LTDevice.desktop:
                        text += "Device: Desktop";
                        break;
                     case lt.LTDevice.mobile:
                        text += "Device: Mobile";
                        break;
                     case lt.LTDevice.tablet:
                        text += "Device: Tablet";
                        break;
                     case lt.LTDevice.unknown:
                     default:
                        text += "Device: Unknown";
                        break;
                  }
                  text += "\r\n";

                  // Show the Browser
                  switch (lt.LTHelper.browser) {
                     case lt.LTBrowser.internetExplorer:
                        text += "Browser: InternetExplorer";
                        break;
                     case lt.LTBrowser.firefox:
                        text += "Browser: Firefox";
                        break;
                     case lt.LTBrowser.chrome:
                        text += "Browser: Chrome";
                        break;
                     case lt.LTBrowser.safari:
                        text += "Browser: Safari";
                        break;
                     case lt.LTBrowser.opera:
                        text += "Browser: Opera";
                        break;
                     case lt.LTBrowser.android:
                        text += "Browser: Android";
                        break;
                     case lt.LTBrowser.unknown:
                     default:
                        text += "Browser: Unknown";
                        break;
                  }
                  text += "\r\n";

                  // Show version and vendor
                  text += "Version: " + lt.LTHelper.version + "\r\n";
                  text += "Vendor: " + lt.LTHelper.vendor + "\r\n";

                  // Show the capabilities
                  text += "SupportsCanvas: " + lt.LTHelper.supportsCanvas + "\r\n";
                  text += "SupportsTypedArray: " + lt.LTHelper.supportsTypedArray + "\r\n";
                  text += "SupportsTouch: " + lt.LTHelper.supportsTouch + "\r\n";
                  text += "SupportsMultiTouch: " + lt.LTHelper.supportsMultiTouch + "\r\n";
                  text += "SupportsWebGL: " + lt.LTHelper.supportsWebGL + "\r\n";
                  text += "SupportsTransform: " + lt.LTHelper.supportsTransform + "\r\n";
                  text += "SupportsTransitionEnd: " + lt.LTHelper.supportsTransitionEnd + "\r\n";
                  text += "SupportsAnimationFrame: " + lt.LTHelper.supportsAnimationFrame + "\r\n";

                  // output the result into the text area
                  var outputTextArea = document.getElementsByName("outputTextArea")[0];
                  outputTextArea.value = text;
                  outputTextArea.scrollTop = outputTextArea.scrollHeight;
               }, false);
            },
         }

         DefaultPage.registerClass("DefaultPage", null, ss.IDisposable);
         var page = null;
         var windowLoad = null;
         var windowUnload = null;
         windowLoad = function (e) {
            window.removeEventListener("load", windowLoad, false);
            page = new DefaultPage();
            page.run();
            window.addEventListener("unload", windowUnload, false);
         };
         windowUnload = function (e) {
            window.removeEventListener("unload", windowUnload, false);
            page.dispose();
         };
         window.addEventListener("load", windowLoad, false);
      })();
   </script>
</head>
<body>
   <input type="button" id="LTHelperExampleButton" value="LTHelper Example" />
   <div>
      <textarea name="outputTextArea" cols="80" rows="10"></textarea>
   </div>
</body>
</html>
See Also

Reference

LTHelper Members
Leadtools Namespace

 

 


Products | Support | Contact Us | Copyright Notices
© 2006-2014 All Rights Reserved. LEAD Technologies, Inc.