Link to home
Start Free TrialLog in
Avatar of leclaude
leclaudeFlag for United States of America

asked on

Permission Denied when accessing parent from child window

Hi,
I have a window that uses Javascript to add rows to an HTML table on its parent window.  That works fine and I then press 'save' on the parent window to commit it to the database and refresh the screen with the new data.
However, when I again try to access the parent window's element from the child's (even just referencing some component), I get a Permission Denied javascript error.  It seems like when the parent window refreshes, the image of its contents changes (although the content are the same).  For example, trying table.addRow, deleteRow, or even referencing table.rows.length, cause the error.  Both windows are in the same domain so cross-site scripting restrictions shouldn't be an issue.  I'm using ie7.
Is there a way for the child window to reference the parent after the parent refresh, or is there another issue involved?  
Thanks
Avatar of abel
abel
Flag of Netherlands image

Unfortunately, there's indeed another issue involved. The child window only has access to the parent window if the parent window created the child window (confusing, I know, but that's how it works). This is a security measurement, to prevent you from popping up a window that can gain control over any other window, whether they show google.com, experts-exchange.com or your site.

This is one of those security cases where the good guys suffer from the behavior of the bad guys. But other then instructing your users to lower their security, or to close and reopen your child window, you cannot do much I'm afraid.
ASKER CERTIFIED SOLUTION
Avatar of abel
abel
Flag of Netherlands image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of leclaude

ASKER

I was actually able to fix this.  I was setting the variable that held the parent element items to null if the element wasn't found.  Instead I need to re-reference it when the page refreshes and that fixed the problem.
Glad you sorted it out. You can select your own comment as answer, or select your own comment as answer and give some points for the effort the expert(s) have invested in helping you... ;)