{"id":44,"date":"2009-06-24T18:39:38","date_gmt":"2009-06-24T16:39:38","guid":{"rendered":"http:\/\/kinsey.no\/blog\/?p=44"},"modified":"2010-02-09T01:20:10","modified_gmt":"2010-02-08T23:20:10","slug":"easyxss","status":"publish","type":"post","link":"https:\/\/kinsey.no\/blog\/index.php\/2009\/06\/24\/easyxss\/","title":{"rendered":"easyXSS"},"content":{"rendered":"<p>Please see <a href=\"http:\/\/kinsey.no\/blog\/index.php\/2009\/08\/20\/easyxdm\/\">easyXDM <\/a>for updated info!<\/p>\n<p>I&#8217;ve just completed the first version of my cross-site scripting library easyXSS. It is available at <a href=\"http:\/\/code.google.com\/p\/easyxss\/\">http:\/\/code.google.com\/p\/easyxss\/<\/a> under a MIT-license.<\/p>\n<p>As it is now it supports simple messaging between windows of different domains, but it also supports proxying method calls and results between them making it well-suited for creating API&#8217;s.<\/p>\n<p>I&#8217;ve prepared several examples and demo&#8217;s at <a href=\"http:\/\/code.google.com\/p\/easyxss\/\">http:\/\/code.google.com\/p\/easyxss\/<\/a> and look forward to getting feedback!<br \/>\n<!--more--><br \/>\nTo show you a quick example, here is the code needed to have a method &#8216;doMagic&#8217; that is located on domainA available in a window from domainB.<\/p>\n<p>This is placed in the document api.html at domainA<\/p>\n<pre class=\"brush: jscript; smart-tabs: true; tab-size: 4; title: ; notranslate\" title=\"\">\r\nvar channel = easyXSS.createChannel({\r\nonReady: function(){\r\nremote = easyXSS.createInterface(channel, {\r\nlocal: {\r\ndoMagic: _privateMethodDoingMagic\r\n}\r\n});\r\n}\r\n});\r\n<\/pre>\n<p>and this is placed in the document at domainB<\/p>\n<pre class=\"brush: jscript; smart-tabs: true; tab-size: 4; title: ; notranslate\" title=\"\">\r\nvar remote;\r\nvar channel = easyXSS.createChannel({\r\nlocal: &amp;quot;\/hash.html&amp;quot;,\r\nremote: &amp;quot;http:\/\/domaina.com\/api.html&amp;quot;,\r\nonReady: function(){\r\nremote = easyXSS.createInterface(channel, {\r\nremote: {\r\ndoMagic: {}\r\n}\r\n});\r\n}\r\n});\r\n<\/pre>\n<p>The medhod doMagic can now be called from domainB using<\/p>\n<pre class=\"brush: jscript; smart-tabs: true; tab-size: 4; title: ; notranslate\" title=\"\">\r\nremote.doMagic('argument1',2,'three',function(result){\r\n\/\/ Consume the result\r\n});\r\n<\/pre>\n<!-- AddThis Advanced Settings generic via filter on the_content --><!-- AddThis Share Buttons generic via filter on the_content -->","protected":false},"excerpt":{"rendered":"<p>Please see easyXDM for updated info! I&#8217;ve just completed the first version of my cross-site scripting library easyXSS. It is available at http:\/\/code.google.com\/p\/easyxss\/ under a MIT-license. As it is now it supports simple messaging between windows of different domains, but it also supports proxying method calls and results between them making it well-suited for creating [&hellip;]<!-- AddThis Advanced Settings generic via filter on get_the_excerpt --><!-- AddThis Share Buttons generic via filter on get_the_excerpt --><\/p>\n","protected":false},"author":3,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[56,34,1],"tags":[32,28,8,22,30],"_links":{"self":[{"href":"https:\/\/kinsey.no\/blog\/index.php\/wp-json\/wp\/v2\/posts\/44"}],"collection":[{"href":"https:\/\/kinsey.no\/blog\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/kinsey.no\/blog\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/kinsey.no\/blog\/index.php\/wp-json\/wp\/v2\/users\/3"}],"replies":[{"embeddable":true,"href":"https:\/\/kinsey.no\/blog\/index.php\/wp-json\/wp\/v2\/comments?post=44"}],"version-history":[{"count":20,"href":"https:\/\/kinsey.no\/blog\/index.php\/wp-json\/wp\/v2\/posts\/44\/revisions"}],"predecessor-version":[{"id":248,"href":"https:\/\/kinsey.no\/blog\/index.php\/wp-json\/wp\/v2\/posts\/44\/revisions\/248"}],"wp:attachment":[{"href":"https:\/\/kinsey.no\/blog\/index.php\/wp-json\/wp\/v2\/media?parent=44"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/kinsey.no\/blog\/index.php\/wp-json\/wp\/v2\/categories?post=44"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/kinsey.no\/blog\/index.php\/wp-json\/wp\/v2\/tags?post=44"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}