this might work on ie and mozilla but if does not work on netscape then
check this post.
http://www.experts-exchang
Main Topics
Browse All TopicsHi,
There are two servers
Server 1:
servername1.abc.xyz.com
Server 2:
servername2.abc.xyz.com
I have an asp page having 3 frames on Server1. (the top frame, the left frame and the mainframe). I trying to call an asp page from the left frame to be displayed in the mainframe from a different server (Server2) which is also in our own domain. I am able to see the page for the first time but getting an "Access Denied" error when i click on any other link afterwards.
I am trying to set the document.domain property in a body onload javascript function in both the pages (The left frame page and the page that is being called from the other server), but it is not assigning the value and giving the "Invalid Argument" error.
//function called from the body onload
function SetDomain ()
{
alert(document.domain); //gives machine name
document.domain="xyz.com";
}
When i do an alert(document.domain); it is returning my computer name but when i am trying to set the value, it is giving me the invalid argument error.
Is this the only way (document.domain) to solve this problem? I would really appreciate and award maximum points for any help on this.
Thanks,
Rabbani
This Question has been solved and asker verified All Experts Exchange premium technology solutions are available to subscription members.
Experts Exchange has been collecting answers to technology questions since 1996…3 million and counting! If you have a question, chances are we already have your answer.
If you can't find the exact answer you're looking for, ask our exclusive community of 50,000 experts. You’ll get a personalized answer from a trusted professional.
Thousands of free tech tips, tricks, how-to’s and tutorials are available in our peer reviewed articles section. See for yourself how smart our experts are, no login required.
Access the answers to your technology questions today.
30-day free trial. Register in 60 seconds.
Members of the expert community talk about why the experience at Experts Exchange is different than what you will find anywhere else.

Try it out and discover for yourself.
30-day free trial. Register in 60 seconds.
Join the community of experts here and help other tech pros by answering question in your area of expertise. You can earn FREE access to all Experts Exchange's premium features and resources.
this might work on ie and mozilla but if does not work on netscape then
check this post.
http://www.experts-exchang
Hi,
Thanks for the reply. I added the leading dot as suggested by you, but still getting the Invalid argument error.
function openUrl()
{
alert(document.domain);
document.domain=".xyz.com"
alert(document.domain);
window.open ("http://Server2/testpage.
}
We only use IE, so i dont have to worry about Netscape. Is document.domain a read only property?
Thanks
i tihink with this u need to use fully qualified domain name.
After execution of that statement, the page would pass the origin check with http://www.xyz.com/
Origin Checks and document.domain
There is one exception to the same origin rule. A script can set the value of document.domain to a suffix of the current domain. If it does so, the shorter domain is used for subsequent origin checks. For example, suppose a script in the document at http://www.company.com/dir
document.domain = "company.com";
After execution of that statement, the page would pass the origin check with http://company.com/dir/pag
source: http://nn.pp.ru/art/javasc
also could u check this post.
http://www.experts-exchang
also check this post too.
http://www.experts-exchang
I tried to set the document.domain property as described in the above links, but it did'nt help. It is not taking any thing.
i tried
//Server 1:
//servername1.abc.xyz.com
//Server 2:
//servername2.abc.xyz.com
function openUrl()
{
alert(document.domain);
document.domain=".xyz.com"
alert(document.domain);
window.open ("http://Server2/testpage.
}
I tried all of these
document.domain="xyz.com";
document.domain=".xyz.com"
document.domain="abc.xyz.c
document.domain=".abc.xyz.
document.domain=".abc.xyz"
document.domain="document.
alert (document.domain); gives machine name
document.domain="machine name"; //Does not give error
alert (document.domain); gives machine name
are there any properties that need to be set?
Thanks
Actually, the url used to access should be fully qualified. i.e
document.domain="xyz.com";
http://servername1.abc.xyz
and gives invalid argument error with this
http://servername1/testpag
The origin check as mentioned by you might have been failing in the later case.
By default, the domain property is the same as the hostname of the web server from which the document was loaded. You can set this property, but only to a string that is a valid domain suffix of itself. Thus, if domain is the string "home.xyz.com", you can set it to the string "xyz.com", but not to "home.xyz", "abc.com" or "abc.xyz.com".
If two windows contain scripts that both set their domain to the same value, then the access issue will be resolved for these two windows/frames and in each of windows/frames may read properties from the other.
Business Accounts
Answer for Membership
by: shivsaPosted on 2003-12-19 at 00:22:27ID: 9970641
document.domain="xyz.com"; ;
u have to add leading . with xyz.com like document.domain=".xyz.com"