This week's book giveaway is in the OCAJP 8 forum. We're giving away four copies of OCA Java SE 8 Programmer I Study Guide and have Edward Finegan & Robert Liguori on-line! See this thread for details.
I know that you get a permission denied error when you try to modify a window from a different domain. I'm getting the problem in my application, but the domains are the same. It happens intermittently, which is the most frustrating part. Here's what's happening. I've got a form with some fields in it, and a link to launch a popup to allow the user to search for values to put into the form. They click on the value and poof! the form field is populated with that value. Parent: productSearch = window.open(searchUrl,'productsearch'); productSearch.opener = self; Child: opener.document.forms.month.value=month; Any thoughts? Thanks.
Hi Mary, I am taking a guess, but could the problem be that you're specifying the opener in the opener? It seems logical to me that "opener" might be a private object to each page, as allowing another page to set it might be a security issue. In my experience, the child window ought to know its opener without it being explicitly set. g.
From the parent window, the child window must be opened using relative URL and not the absolute URL even though they belong to the same domain. By doing this, the 'access denied' error will not appear again. For example, lets say, the domain is www.xyz.com; Parent: productSearch = window.open("/search",'productsearch'); Child: opener.document.forms.month.value=month;
(productSearch.opener = self; No need for this line). Note the relative path URL in the parent window script when opening a new window. If the same code in the parent window is written as productSearch = window.open("http://www.xyz.com/search",'productsearch'), you will encounter 'Access Denied' error.
I have personally experienced this problem and solved it using the solution that I presented above. I am sure, it will work for you too. Best of Luck.
Originally posted by Mary Mascari: Tried it - no good. Any other suggestions?
Hello Ranchers, reopening a very old post! further to solution given by Mohamed Yousuff, what if the window opened by parent window is not on the same domain?
I am facing this problem as:
My parent page has a select box where person's names are supposed to be displayed.
In order to enter names in this box, user is dependent on centralized repository of names.
This is not a database like sybase or oracle so my java code cannot user it directly via jdbc. So the user clicks on a button that opens up a child window with URL of different domain.
Here the error Permission Denied appears on child window. I am really stuck. Is there any workaround of this problem?
[ October 10, 2006: Message edited by: Harshil Mehta ] [ October 10, 2006: Message edited by: Harshil Mehta ]
@Mohamed Yousuff: I know I am replying to a very old post here. But I couldn't resist my self not thanking you. I have searched the net for the solution for last couple of days and no one has this simple solution.
Thank you again. This information was really helpful.
MURAD (SCJP 5.0, SCWCD 1.4)
If you learn to program in Java, you'll never be without a job! (Patricia Seybold in 1998) - Knowing the syntax of Java does not make someone a software engineer. (John Knight)