By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
443,665 Members | 1,251 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 443,665 IT Pros & Developers. It's quick & easy.

Why is this not seen as same domain?

P: 1
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]
Oct 10 '07 #1
Share this Question
Share on Google+
1 Reply


acoder
Expert Mod 15k+
P: 16,027
Welcome to TSDN!

You may need to use document.domain. See same origin policy.
Oct 15 '07 #2

Post your reply

Sign in to post your reply or Sign up for a free account.