I have 2 iframes on a page, one of which i want to get it's location everytime it loads (and set an text input to that value). As the iframe is set to a domain not the same as the one where the script is, i use a proxy to navigate to that url....
ie
http://www.myscriptsdomain.com/proxy....urltoview.com
Thing is i'm getting permission denied/uncaught exception errors in FF.
[HTML]<script>
function frameonload(what) {
//var str = window.frames[0].location;
//var str = document.getElementById("affframe2").location.href ;
var str = parent.frames['affframe2'].location.href;
//var str = window.affframe2.location.href;
//var str = document.getElementById("affframe2").location;
//var str = document.frames['affframe2'].location.href;
//var str = unescape(what.src);
//str = str.substring(88);
//str = str.slice(0, -5);
document.getElementById('targeturl').value = str;
}
</script>
<div id="outer">
<iframe name="affframe2"
frameborder="0"
src="http://www.myscriptsdomain.com/proxy.php?url=http://www.urltoget.com"
id="affframe2"
name="affframe2"
onload="frameonload(this);">
</iframe>
</div>[/HTML]
As you can see i have tried every possibility i can think of, nothing works...
errors i get are:
Error: uncaught exception: Permission denied to get property Location.href
Error: uncaught exception: [Exception... "Could not convert JavaScript argument" nsresult: "0x80570009 (NS_ERROR_XPC_BAD_CONVERT_JS)" location: "JS frame :: http://******************.php :: frameonload :: line 75" data: no]