Home Articles FAQs XREF Games Software Instant Books BBS About FOLDOC RFCs Feedback Sitemap
irt.Org
#

Q94 Why do I get an error message when trying to find the location of the document in the parent or sibling frame from another frame?

You are here: irt.org | FAQ | JavaScript | Frame | Q94 [ previous next ]

Accessing the properties of the frame only works if the page loaded in that frame is on the same server as the document accessing that frame. As soon as the frame contains a page from another server you'll get the following JavaScript alert:

Access disallowed at
http://www.somewhere.com/page1.html to
documents at http://www.somewhereelse.com/page2.htm

You've hit what's called 'Tainting'. Its a security restriction. There's nothing you can do about external pages. However, if you just want to track your own pages, then you could do it in reverse.

Instead of your frame checking the contents of the unknown frame, you could swap it around so that the unknown frame tells your frame what it contains whilst its loading.

In the parent document:

<frameset rows="60,*">
    <frame src="unknown.html" name="unknown" frameborder="0" border="0">
    <frame src="your.html" name="your" frameborder="0" border="0>
</frameset>

In the your.html document:

<form name="loaded">
<input name="display" type="input" size="40">
</form>

And in the unknown.html document:

<html>
<head>
<script language="JavaScript"><!--
parent.your.loaded.display.value = "Its me!";
//--></script>
</head>
<body>
...
</body>
</html>

©2018 Martin Webb