tags:

views:

74

answers:

2

Error: Permission denied for sitename to get property Location.href from sitename.

I have an iframe in a webpage. This iframe has Click here to register link that redirects to the new window webpage. I am getting the above error when click here is clicked.

Please help in this issue.

<a href="javascript:openEventReg()"  is called when click here is selected

<script>
function openEventReg()
{
username=document.getElementById('username').value;
var id = gup( 'id' );
var eventname;
return ("/registration/eventregister.php?event=testing&uname="+username);
 }
function gup( name )
{
  name = name.replace(/[\[]/,"\\\[").replace(/[\]]/,"\\\]");
  var regexS = "[\\?&]"+name+"=([^&#]*)";
  var regex = new RegExp( regexS );
  var results = regex.exec( parent.location.href );
  if( results == null )
    return "";
  else
    return results[1];
}
</script>
+3  A: 

This is the intended behaviour in modern browsers. Frames are not allowed to access their parents in any way unless they reside on the same domain. This is done in an attempt to prevent cross-site scripting attacks.

Max Shawabkeh
A: 

put your redirect function in your main html. On click just call parent.funcName().

jikhan