...

View Full Version : Problems verifying a location in frames



debt
05-21-2005, 02:47 AM
I made a code to show the CURRENT location of an opened window, but
the JS console in firefox gives me: "Error: uncaught exception: Permission denied to get property Location.href"



<html><head>
<script language="Javascript">
function newWin() {
BNEW=window.open("frames.htm", "BNEW");
BNEW.location.href = "frames.htm";
if (BNEW.opener == null) BNEW.opener = window;
}

function theLoc() {
document.write("<font face='arial' size='12' color='black'>"+BNEW.up.location.href+"</font>")
}

</script>
</head>
<body>
<input type="button" value="Open" onClick="newWin()">
<input type="button" value="Click" onClick="theLoc()">
</body>
</html>


Here's the code for "frames.htm":



<html>
<frameset rows="50%, 50%" frameborder="1">
<frame name="up" src="http://www.google.com">
<frame name="down" src="2.html">
</frameset>

</html>


Any help would be appreciated. Thanks.

Harry Armadillo
05-21-2005, 03:29 AM
You can't get information from/about windows/frames that contain documents that come from another domain.

debt
05-21-2005, 10:17 AM
Is there anyway to circumvent the security restriction?

Harry Armadillo
05-21-2005, 09:23 PM
For IE, developing your page as a .hta application will allow it, as may some ActiveX junk.

For Gecko-browsers, the function netscape.security.PrivilegeManager.enablePrivilege(privilege) will ask the user if they want to grant your page the power to do potentially bad things.

Unless you're doing this for an internal application, where you can force users to accept .hta/ActiveX/enhanced-privileges, forget it.

debt
05-22-2005, 04:46 AM
Wow. Thanks for the tip. I have all the functionality I need now using the .hta extension. I love you.



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum