<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Emposha &#187; crossdomain</title>
	<atom:link href="http://www.emposha.com/tag/crossdomain/feed" rel="self" type="application/rss+xml" />
	<link>http://www.emposha.com</link>
	<description>Just another stupid wordpress blog ;)</description>
	<lastBuildDate>Thu, 08 Dec 2011 13:30:45 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3</generator>
		<item>
		<title>Cross-Domain Javascript execution library</title>
		<link>http://www.emposha.com/javascript/cross-domain-javascript-execution-library.html</link>
		<comments>http://www.emposha.com/javascript/cross-domain-javascript-execution-library.html#comments</comments>
		<pubDate>Tue, 17 Mar 2009 10:56:36 +0000</pubDate>
		<dc:creator>emposha</dc:creator>
				<category><![CDATA[Featured Articles]]></category>
		<category><![CDATA[Javascript]]></category>
		<category><![CDATA[cross-domain]]></category>
		<category><![CDATA[crossdomain]]></category>

		<guid isPermaLink="false">http://www.emposha.com/?p=165</guid>
		<description><![CDATA[In one of the projects I am faced with problem of the java scripts execution on different domains.
After advice from one of team leaders, the solution was found and it was a quite simple.]]></description>
			<content:encoded><![CDATA[<p>In one of the projects I am faced with problem of the java scripts execution on different domains.<br />
After advice from one of team leaders, the solution was found and it was a quite simple.<br />
For example, we have A domain with frame that point to domain B which is to call javascript function in domain A.<br />
If you simply call a window.parent.funcame you will get exception. So what can we do ?<br />
It is very simple &#8211; in domain B we create frame to  domain A and then we try to execute a function on domain  A as window.parent.parent.fucname and how we can see function is executed succesufully.</p>
<p>So this script does this operation automatically without requiring knowledge of java script.</p>
<p><strong>Credits: </strong>Nir Levy</p>
<p><strong>Usage:</strong></p>
<p>Domain A:</p>
<p><em>Main file:</em></p>
<blockquote><p><code><span style=" color: black; "><span style="color: #0000ff;">&lt;</span><span style="color: #800000;">html</span><span style="color: #0000ff;">&gt;</span><br />
<span style="color: #0000ff;">&lt;</span><span style="color: #800000;">head</span><span style="color: #0000ff;">&gt;&lt;</span><span style="color: #800000;">title</span><span style="color: #0000ff;">&gt;</span>domain_a<span style="color: #0000ff;">&lt;/</span><span style="color: #800000;">title</span><span style="color: #0000ff;">&gt;&lt;/</span><span style="color: #800000;">head</span><span style="color: #0000ff;">&gt;</span><br />
<span style="color: #0000ff;">&lt;</span><span style="color: #800000;">body</span><span style="color: #0000ff;">&gt;</span><br />
<span style="color: #0000ff;">&lt;</span><span style="color: #800000;">script</span><span style="color: #0000ff;">&gt;</span><br />
<span style="color: #0000ff;">function</span> showmelove(text)<br />
{<br />
alert(text);<br />
}<br />
<span style="color: #0000ff;">&lt;/</span><span style="color: #800000;">script</span><span style="color: #0000ff;">&gt;</span><br />
... some content here ...<br />
<span style="color: #0000ff;">&lt;</span><span style="color: #800000;">iframe</span> <span style="color: #ff0000;">id</span><span style="color: #0000ff;">="hpel"</span> <span style="color: #ff0000;">height</span><span style="color: #0000ff;">="100"</span> <span style="color: #ff0000;">frameborder</span><span style="color: #0000ff;">="0"</span> <span style="color: #ff0000;">width</span><span style="color: #0000ff;">="100%"</span> <span style="color: #ff0000;">scrolling</span><span style="color: #0000ff;">="0"</span> <span style="color: #ff0000;">title</span><span style="color: #0000ff;">=""</span> <span style="color: #ff0000;">src</span><span style="color: #0000ff;">="http://domain_b/iframe.html"</span> <span style="color: #ff0000;">style</span><span style="color: #0000ff;">="height: 194px;"</span><span style="color: #0000ff;">&gt;&lt;/</span><span style="color: #800000;">iframe</span><span style="color: #0000ff;">&gt;</span><br />
... some content here ...<br />
<span style="color: #0000ff;">&lt;/</span><span style="color: #800000;">body</span><span style="color: #0000ff;">&gt;</span><br />
<span style="color: #0000ff;">&lt;/</span><span style="color: #800000;">html</span><span style="color: #0000ff;">&gt;</span> </span></code></p>
<p><code> </code><code><br />
<span style="color: gray; font-size: xx-small;">* This source code was highlighted with <a href="http://virtser.net/blog/post/source-code-highlighter.aspx"><span style="color: gray; font-size: xx-small;">Source Code Highlighter</span></a>.</span></code></p></blockquote>
<p><em>Exec file:</em></p>
<blockquote><p><code><span style=" color: black; "><span style="color: #0000ff;">&lt;</span><span style="color: #800000;">html</span><span style="color: #0000ff;">&gt;</span><br />
<span style="color: #0000ff;">&lt;</span><span style="color: #800000;">body</span><span style="color: #0000ff;">&gt;</span><br />
<span style="color: #0000ff;">&lt;</span><span style="color: #800000;">script</span> <span style="color: #ff0000;">type</span><span style="color: #0000ff;">="text/javascript"</span> <span style="color: #ff0000;">src</span><span style="color: #0000ff;">="crossdomain_server.js"</span><span style="color: #0000ff;">&gt;&lt;/</span><span style="color: #800000;">script</span><span style="color: #0000ff;">&gt;</span><br />
&lt;script type=<span style="color: #a31515;">"text/javascript"</span>&gt;<br />
crossdomain.server().init();<br />
<span style="color: #0000ff;">&lt;/</span><span style="color: #800000;">script</span><span style="color: #0000ff;">&gt;</span><br />
<span style="color: #0000ff;">&lt;/</span><span style="color: #800000;">body</span><span style="color: #0000ff;">&gt;</span><br />
<span style="color: #0000ff;">&lt;/</span><span style="color: #800000;">html</span><span style="color: #0000ff;">&gt;</span></span> </code></p>
<p><code> </code><code><span style="color: gray; font-size: xx-small;">* This source code was highlighted with <a href="http://virtser.net/blog/post/source-code-highlighter.aspx"><span style="color: gray; font-size: xx-small;">Source Code Highlighter</span></a>.</span></code></p></blockquote>
<p>Domain B:</p>
<blockquote><p><code><span style=" color: black; "><span style="color: #0000ff;">&lt;</span><span style="color: #800000;">html</span><span style="color: #0000ff;">&gt;</span><br />
<span style="color: #0000ff;">&lt;</span><span style="color: #800000;">head</span><span style="color: #0000ff;">&gt;</span><br />
<span style="color: #0000ff;">&lt;</span><span style="color: #800000;">script</span> <span style="color: #ff0000;">src</span><span style="color: #0000ff;">="crossdomain_client.js"</span> <span style="color: #ff0000;">type</span><span style="color: #0000ff;">="text/javascript"</span> <span style="color: #0000ff;">&gt;&lt;/</span><span style="color: #800000;">script</span><span style="color: #0000ff;">&gt;</span><br />
&lt;script&gt;<br />
crossdomain.client(<span style="color: #a31515;">"frame"</span>).init(<span style="color: #a31515;">"http://www.domain_a/iframe.html"</span>);</span></code></p>
<p><code> </code><code> <span style="color: #0000ff;">function</span> sendText() {<br />
crossdomain.client(<span style="color: #a31515;">"frame"</span>).callfunc(<span style="color: #a31515;">"showmelove"</span>,{mesasge: <span style="color: #a31515;">"'hello world'"</span>});<br />
}<br />
<span style="color: #0000ff;">&lt;/</span><span style="color: #800000;">script</span><span style="color: #0000ff;">&gt;</span><br />
<span style="color: #0000ff;">&lt;/</span><span style="color: #800000;">head</span><span style="color: #0000ff;">&gt;</span><br />
<span style="color: #0000ff;">&lt;</span><span style="color: #800000;">body</span><span style="color: #0000ff;">&gt;</span><br />
<span style="color: #0000ff;">&lt;</span><span style="color: #800000;">div</span> <span style="color: #ff0000;">id</span><span style="color: #0000ff;">="allBodyDiv"</span><span style="color: #0000ff;">&gt;</span><br />
some content goes here...<br />
<span style="color: #0000ff;">&lt;</span><span style="color: #800000;">input</span> <span style="color: #ff0000;">type</span><span style="color: #0000ff;">="button"</span> <span style="color: #ff0000;">value</span><span style="color: #0000ff;">="send"</span> <span style="color: #ff0000;">onclick</span><span style="color: #0000ff;">="sendText()"</span> <span style="color: #0000ff;">/&gt;</span><br />
<span style="color: #0000ff;">&lt;/</span><span style="color: #800000;">div</span><span style="color: #0000ff;">&gt;</span><br />
<span style="color: #0000ff;">&lt;/</span><span style="color: #800000;">body</span><span style="color: #0000ff;">&gt;</span><br />
<span style="color: #0000ff;">&lt;/</span><span style="color: #800000;">html</span><span style="color: #0000ff;">&gt;</span> </code></p>
<p><code> </code><code><span style="color: gray; font-size: xx-small;">* This source code was highlighted with <a href="http://virtser.net/blog/post/source-code-highlighter.aspx"><span style="color: gray; font-size: xx-small;">Source Code Highlighter</span></a>.</span></code></p></blockquote>
<p><strong>Download</strong><strong>: <span style="font-weight: normal;"><a href="http://www.emposha.com/upload/crossdomain.zip" target="_blank">CrossDomain</a></span></strong></p>
]]></content:encoded>
			<wfw:commentRss>http://www.emposha.com/javascript/cross-domain-javascript-execution-library.html/feed</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
	</channel>
</rss>

