468,244 Members | 1,860 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 468,244 developers. It's quick & easy.

Why is this not seen as same domain?

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
1 1416
acoder
16,027 Expert Mod 8TB
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.

Similar topics

12 posts views Thread by Steven T. Hatton | last post: by
3 posts views Thread by Rob | last post: by
45 posts views Thread by Brett | last post: by
6 posts views Thread by scottyman | last post: by
9 posts views Thread by Mark P | last post: by
4 posts views Thread by =?Utf-8?B?YzY3NjIyOA==?= | last post: by
reply views Thread by NPC403 | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.