title: Uncaught TypeError: Cannot read property 'version' of undefined at file
body: <p>For saving canvas image to gallery i tried by creating plugin along with below piece of  javascript code in phonegap, but after button click i got "<code>Uncaught TypeError: Cannot read property 'version' of undefined at file:///android_asset/www/index.html:18"
  </code>     for the code</p>
  
  <pre><code>&lt;script type="text/javascript" charset="utf-8" src="cordova.js"&gt;&lt;/script&gt;
  &lt;script src="http://code.jquery.com/jquery-latest.min.js" type="text/javascript"&gt;&lt;/script&gt;    
  &lt;script type="text/javascript" charset="utf-8" src="SavePhotoPlugin.js"&gt;&lt;/script&gt;
  &lt;link rel="stylesheet" href="index.css" /&gt; 
  &lt;script type="text/javascript"&gt; 
  document.addEventListener("deviceready", onDeviceReady, false);
  
   function onDeviceReady() {
          var element = document.getElementById('myCanvas');
  
      }
      function share() {      
  
          var canvas = document.getElementById("myCanvas");
          window.savephotoplugin(canvas,"image/png",device.version,function(val){ 
            //returns you the saved path in val   
                  alert("Photo Saved: " + val);   
          });
      }
  &lt;/script&gt;
      &lt;/head&gt;
       &lt;body&gt;
  
         &lt;div &gt;
  
       &lt;IMG SRC="loadin.png" ALT="some text" WIDTH=100 HEIGHT=100&gt;
       &lt;button class="button" id="myCanvas" onclick="share()"&gt;SAVE &lt;/button&gt;
        &lt;/div&gt;
  </code></pre>
  
  <p>i tried with cordova 2.2, 2.9 for all the version the remains the same, tested on 2.3 version device. is this problem with the cordova version of device, or some other issue, please anybody point out mistake. </p>