Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

access denied error

Status
Not open for further replies.

ksoong

Programmer
Oct 3, 2000
57
CA
Hi everyone. i'm working on a web page on a web community. The web community used to support operations on parent.location, or top.framename.name.

however now, whenever i try to perform an operation on any frame property, such as parent.location it gives me an "access denied" javascript error.

I don't understand why. When I output the value it gives me an object. i.e.

alert(parent.location);

will pop-up an alert box with "[object]" in it. Before this worked fine.

Also when I put

if (parent.location!="blah")

this gives me an access denied error as well. Can someone tell me what's going on here and what i can do to solve the problem?

i know it's not my browser because i tested a the javascript i'm working on in another frameset and it worked just fine.

thanks,

ken
 
actually. to make it exact it says

"Access is denied"
 
If the parent location is in a different domain than the page with the code you are executing, that would be the cause of your problem. The "same domain" security model prohibits querying the location across domains. Tracy Dryden
tracy@bydisn.com

Meddle not in the affairs of dragons,
For you are crunchy, and good with mustard.
 
ok. i think i get what you're saying.

so if the main body page that i was working on was linked to

somedomain.com

but the parent was linked to
would that " make a difference with respects to the "access is denied" error?
 
I don't believe the " should cause that error, but it IS a possibility.
Tracy Dryden
tracy@bydisn.com

Meddle not in the affairs of dragons,
For you are crunchy, and good with mustard.
 
Hi,
I'm having the same problem:
"access disallowed from scripts at
to documents at another domain."
Is there any solution to access the data although the frame sources are from two different domains?
Thanks.
 
What, exactly, is it that you are trying to do? It doesn't sound like quite the same situation.
Tracy Dryden
tracy@bydisn.com

Meddle not in the affairs of dragons,
For you are crunchy, and good with mustard.
 
I'll try to specify my problem:
I'm having a frameset with two Frames, A and B. But the source of Frame A is at another domain ( than Frame B (If in Frame A is loaded I want to load in Frame B. Therefore I use "parent.frames[1].location.href = That seems not working because when I test it the Netscape-JavaScript-Console says: "access disallowed from scripts at
to documents at another domain."

If there doesn't exist any solution for this problem, maybe someone has an idea how to realize it another way.
 
Actually, I'm not quite sure what the problem is, unless has some security set. You can find out what the url loaded into another frame is unless it's in the same domain, but you should be able to SET the url to a different domain. I've seen lots of sites with frames containing documents from different domains. Maybe you could try setting document.location instead of document.location.href.
Tracy Dryden
tracy@bydisn.com

Meddle not in the affairs of dragons,
For you are crunchy, and good with mustard.
 
Thanks for your hint tsdragon. The problem was that I didn't only want to set URL of the other frame but also get the URL of it.
Original I wanted to get the URL because it decides what I am going to write in the other frame with javascript. But if that doesn't work I have to create an extra html-page for each situation..
Or is there still a trick how I can get Information about the content of the other Frame (at another domain) ???
 
Draug is correct, you can't get information about another domain, it's part of the security policy. I doubt you can even get info about the content of the frame once it is loaded. At least I know of no trick around it.

However, if you are setting the url of the other frame from some set of known urls (rather than one entered by the user), then you know which url was loaded. Just set a flag or a string variable to indicate which url you loaded. Tracy Dryden
tracy@bydisn.com

Meddle not in the affairs of dragons,
For you are crunchy, and good with mustard.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top