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 strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Simulating detach frame problem

Status
Not open for further replies.

OmniCog

Programmer
Jan 23, 2004
27
0
0
CA
Hi,

I am trying to simulate a detach frame mechanism.

I have 2 frames, mainFrame and leftFrame. I want to be able to let users open a new window with the location of the mainFrame.

I can simulate "detach frame" if the user has not clicked a link, but when the location of the frame is changed the js breaks.

Here is the code:

...
<script>
function detatch_mainframe () {
window.open(parent.mainFrame.location.href);
}
</script>
...
<a href="#" onclick="javascript:detatch_mainframe()">Detatch Frame</a>
...

Is there a work-around for this problem?

TIA
 

You don't need the "javascript:" bit in your onclick event. Try removing it:

Code:
<a href="#" onclick="detatch_mainframe()">Detatch Frame</a>

Hope this helps,
Dan
 
Thanks for the reply, but the "javascript:" part does not effect the problem.
 
Sounds like you're running into a security issue. You can't retrieve the location of another frame if the page isn't on your server. If people could, they would be able to track your movements on the web - a big no no.

Adam
while(ignorance){perpetuate(violence,fear,hatred);life=life-1};
 

>> Thanks for the reply, but the "javascript:" part does not effect the problem.

But that doesn't change the fact that it is not necessary to have it there ;o)

Dan
 
>> But that doesn't change the fact that it is not necessary to have it there ;o)

Your right lol.

>>Sounds like you're running into a security issue. You can't retrieve the location of another frame if the page isn't on your server. If people could, they would be able to track your movements on the web - a big no no.

Oh, I didn't see it that way. I thought it was just a bug in IE.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top