|  |  | 
 |  |  | $('a').click(function() { | 
 |  |  |   var href = this.href; | 
 |  |  |   var target = window.parent; | 
 |  |  |   // Convert Non-SVG images to data URL first  | 
 |  |  |   // Convert Non-SVG images to data URL first | 
 |  |  |   // (this could also have been done server-side by the library) | 
 |  |  |   if(this.href.indexOf('.svg') === -1) { | 
 |  |  |  | 
 |  |  | 
 |  |  |       id: href | 
 |  |  |     }); | 
 |  |  |     target.postMessage(meta_str, "*"); | 
 |  |  |    | 
 |  |  |  | 
 |  |  |     var img = new Image(); | 
 |  |  |     img.onload = function() { | 
 |  |  |       var canvas = document.createElement("canvas"); | 
 |  |  | 
 |  |  |       data = '|' + href + '|' + data; | 
 |  |  |       // This is where the magic happens! | 
 |  |  |       target.postMessage(data, "*"); | 
 |  |  |        | 
 |  |  |  | 
 |  |  |     }, 'html'); // 'html' is necessary to keep returned data as a string | 
 |  |  |   } | 
 |  |  |   return false; |