Intel Web API Connector Documentation and Examples

The Intel Web API Connector manages the installation of other Intel Web APIs. Once the Connector is installed, other Intel Web APIs can be downloaded and installed without a browser restart.

Contents

Overview

The Intel Web APIs are implemented as browser plugins. In order to avoid requiring the viewers of web pages with these plugins to individually download and install the plugins, the Connector simplifies this chore without compromising the viewer's control and security.

When first visting a site using Intel Web APIs, the viewer of the page will be directed to install the Connector. This installation is like any other plugin installation - download the installer, run it, and restart the browser. After this, however, the viewer experiences much different behavior with Intel Web API web pages. Upon subsequent visits to a page with Intel Web APIs, the web page will request that the Connector download and install any required Intel Web APIs. This occurs without the viewer performing the steps manually - so no longer does the viewer need to download, run, and restart.

Instead, after the Connector is installed, the viewer will be prompted to allow or deny each web site requesting other Intel Web APIs. This ensures the viewer remains in control of which web sites can and cannot use Intel Web APIs on his or her machine. The Connector allows the viewer to establish both per-session and permenant whitelists and blacklists. In otherwords, known good and known bad sites.

In addition to viewer-controlled white and black lists, the Connector also refuses to download and install plugins that are not digitally signed by the folks here at Intel working on Intel Web APIs - we don't want a rouge web site to instruct the Connector to download any random plugin!

Browser and Device Compatibility

The table below lists some compatability notes for browser and operating system combinations.

If you are interested in seeing these APIs available on other device types and operating systems please let us know by leaving comments.

BrowserOperating SystemNotes
Firefox 3.5.x, 3.6.x Windows (XP, Vista, Win 7) Seems to be working well.
Chrome 4.0.x.y Windows (XP, Vista, Win 7) Seems to be working well.
Safari 4.0.x Windows (XP, Vista, Win 7) Seems to be working well.
Opera v 10.x Windows (XP, Vista, Win 7) Not currently working. It's on the debug todo list.
Internet Explorer 8.x Windows (XP, Vista, Win 7) Not supported yet. Its on the todo list though.
Firefox, Chrome, Safari Linux, MacOS Not supported yet. Linux and Mac OS porting is underway :)

A code sample to get you started

This HTML & JavaScript shows you how to embed the Intel Connector Web API into your app.

  <div id="IntelWebAPIs_sample_code_status_div" 
    style="border:1px dotted red;width:640px;height:480px;overflow:auto;"></div>
  <script 
    type="text/javascript" 
    src="http://software.intel.com/sites/whatif/webapis/intelwebapis.js">
  </script>
  
  <script type="text/javascript">
  
    // this outer closure just to keep the sample code from cluttering up
    // the namespace with the function names etc being used
    (function() {
      
      //kick off IntelWebAPIs.init() and IntelWebAPIs.require() when
      //the page is loaded
      add_onload_handler( function() {
  
        IntelWebAPIs.init(init_result_func);
        
        //called by IntelWebAPIs.init()
        function init_result_func(result) {
          if(result.success) {
            // now bring in Intel Web APIs required by your app...
            output_status("IntelWebAPIs Connector init success: version " +
                          IntelWebAPIs.connector.version);
          }
          else {
            output_status("IntelWebAPIs Connector init error: " + result.error.msg);
            //handle error condition
            //result.error.msg contains an error message
            //result.connectorInstUrl contains the url to the Intel Web API connector installer
            output_status("you may need to download the Intel Web API connector from here: " + 
              result.connectorInstUrl);
          }
        }
      });     
      
      /* Its recommended that you wait until the document is loaded 
         before calling IntelWebAPIs.init() and IntelWebAPIs.require() 
         This utility helps with that...*/
      function add_onload_handler(addfunc, altwindow) {
        var targwindow = window;
        if(typeof(altwindow) != 'undefined'){
          targwindow = altwindow;
        }
        
        /* chain the onload functions together */
        var prevf = targwindow.onload;
        var newf  = addfunc;
        targwindow.onload = function(){
            newf();
            if(typeof(prevf) == 'function'){
              prevf();
            }
          };
      }
      
      /* utility that outputs status messages to a div*/
      function output_status(str) {
        var divout = document.getElementById("IntelWebAPIs_sample_code_status_div");
        divout.innerHTML += str + "<br/>";
        divout.scrollTop = divout.scrollHeight;
      }
    })(); // end of outer closure
  </script>

Th Object that is passed into callback for the init() function is formatted as follows:

  result = { 
    success           : boolean,
    
    // these fields are valid if success != true
    connectorInstUrl  : string 
    error             : {
      msg             : string 
    } 
  }
If the Intel Web API Connector is not yet installed on a user's device you can use the result.connectorInstUrl to prompt the user, in the context of your app, to install it.
Once the Intel Web API Connector is installed other apis are installed by the connector, with minimal user interruption, when your app calls IntelWebAPIs.require().

JavaScript API Details
These are the properties and methods exposed by the connector Web API:

  IntelWebAPIs.connector = {
    'version'     : string
  };

IntelWebAPIs.connector.version
This is the API's version string. It is formatted as "major.minor.patch" where major and minor are numbers and patch is a string. The connector will auto-update itself during each require() call.
Attributions

Intel Connector Web API uses the following software components:

    • OpenSSL: This product includes software developed by the OpenSSL Project for use in the OpenSSL Toolkit (http://www.openssl.org/). Copyright (c) 1998-2008 The OpenSSL Project. All rights reserved.
    • JSONXX: Copyright (c) 2010 Hong Jiang Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

See it working in this page!
有关编译器优化的更完整信息,请参阅优化通知
标签: