Home: Perl Programming Help: Beginner:
can't get a .location?


Mar 20, 2001, 4:57 AM

Views: 1194
can't get a .location?

I have found that for Security reasons (not quite sure why?) I am not allowed to get the .location value from a frame that contains a page served from another server. I REALLY need to do this.

Script running in Frame1 needs to capture the URL of the page currently in Frame2 nomatter where it came from.

My script works fine as long as the page in Frame2 came from my server. Otherwise I get a "Permission Denied" error. I think I have traced this down to some wonderful thing called "tainting"??

I am simply using frame2.current.location to try and capture the url.

Thanks for any help on this. I am really stuck.


Mar 22, 2001, 12:05 PM

Views: 1184
Re: can't get a .location?

First off, your talking about javascript and not perl. Maby you should try checking a java site such as javascripts.com.

Second, it is impossible to get the URL from .location if the page in .location is not from the same server, unless the user has disabled or messed with his security settings. This is because you could design a javascript to "SPY" on the user and see which pages they visits throughout a whole browser session.

However you can compare or modify the .location value.


A simple frame break script.

if(top.location != location){top.location.href = location.href;}

if the top.location exists and is not the same as location.href then set top.location to location.href