I
Ivo
Dear Newsgroup,
many framed sites have an ancient script in all their pages:
if(top==self) top.location=theframeset
Some friendlier ones do this:
if(top==self) document.write( '<a href=frameset>This page is '
+ 'supposed to be frames</a>.' )
These scripts fail when the page is loaded within somebody's else's
frameset.
Then top is not self but not a very cooperative top either. And with ever
growing security issues browsers have become quite paranoid. Even testing
for top's origin results in an error:
alert(top)
// gives me [object]
var s=''; for (var i in top) s+=i+'\t'+top+'\n'; alert(s);
var obj; try{ obj=top.location; } catch(e) { obj=''; }
// give me [access denied] (of course)
I 'd rather drop the frames altogether, but the site has been like this for
years and the client insists. There are frames. So how would I detect when
it is appropriate to write:
<a href=>View this page in its <b>own</b> frames.</a> ?
Question b:
in the frameset, a little script looks into self.location.search for an url
with which to fill the main frame. Is there a way to avoid document.write
and onload?
Thanks,
Ivo
many framed sites have an ancient script in all their pages:
if(top==self) top.location=theframeset
Some friendlier ones do this:
if(top==self) document.write( '<a href=frameset>This page is '
+ 'supposed to be frames</a>.' )
These scripts fail when the page is loaded within somebody's else's
frameset.
Then top is not self but not a very cooperative top either. And with ever
growing security issues browsers have become quite paranoid. Even testing
for top's origin results in an error:
alert(top)
// gives me [object]
var s=''; for (var i in top) s+=i+'\t'+top+'\n'; alert(s);
var obj; try{ obj=top.location; } catch(e) { obj=''; }
// give me [access denied] (of course)
I 'd rather drop the frames altogether, but the site has been like this for
years and the client insists. There are frames. So how would I detect when
it is appropriate to write:
<a href=>View this page in its <b>own</b> frames.</a> ?
Question b:
in the frameset, a little script looks into self.location.search for an url
with which to fill the main frame. Is there a way to avoid document.write
and onload?
Thanks,
Ivo