Skip to content

Javascript across windows: same domain, different server

February 8, 2007

Because of the Javascript “download and go” execution model security is a big deal and there are numerous restrictions put in place when you try to access the DOM of another page.

But there are many situations where it is useful to be able to communicate information or DOM values between windows that happen to reside on different servers. This is allowed as long as the pages reside in the same <strong>domain</strong>.

The browser has limited information and isn’t smart enough to know that <em>serverA</em> and <em>serverB</em> are in the same domain. You must use a fully qualified name such as <em>serverA.domain.com</em> and <em>serverB.domain.com</em>. However, this is still not enough for IE. In each page you must set the <em>document.domain</em> property to <em>domain.com (a suffix).</em> Only then will your scripts work.

References:
<a target=”_blank” href=”http://msdn.microsoft.com/library/default.asp?url=/workshop/author/dhtml/reference/properties/domain.asp&#8221; mce_href=”http://msdn.microsoft.com/library/default.asp?url=/workshop/author/dhtml/reference/properties/domain.asp”>MSDN: domain property</a>

<a target=”_blank” href=”http://msdn.microsoft.com/library/default.asp?url=/workshop/author/om/xframe_scripting_security.asp&#8221; mce_href=”http://msdn.microsoft.com/library/default.asp?url=/workshop/author/om/xframe_scripting_security.asp”>MSDN: About Cross-Frame Scripting and Security</a>

<a href=”http://www.mozilla.org/projects/security/components/same-origin.html”>The Same Origin Policy</a>

Advertisements

From → Uncategorized

Leave a Comment

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: