Uncaught Exception in FireFox (Permission Denied)

I have a website written using C# in asp.net 2.0.  One of the pages opens a pop-up which allows the user to select a value; the pop-up then writes a value to a hidden field on the parent page and closes itself.  In FireFox I get the following error :

uncaught exception: Permission denied to get property HTMLDocument.getElementById

Having read about a bit for an answer, the common solution seemed to be to do with cross-site scripting - however, both the parent page and the pop-up are in exactly the same domain.  The protocol is the same (both HTTP) and the sub-domain is the same, (www).

Here is the code I use in the pop-up :

<a href="
JavaScript:window.opener.document.getElementById('ctl00_cphMain_txtImageId').value='50518';window.opener.document.getElementById('cbImgThumb').src='assets/assets/0/20/42/92.jpg';window.opener.document.getElementById('cbImgThumb').style.display='block';window.opener.document.getElementById('cbImgThumb').style.height='150';window.opener.document.getElementById('cbImgThumb').style.width='150';window.close();
 ">Click Me</a>

As you can see it sets a few ID values and makes a DIV visible.

I have also tried this in IE7 and get "Access Denied".  I'm pretty sure this worked in IE6.
wilsonrxAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

NorushCommented:
Does the element you are addressing actualy have an attribute called "id".

It sometimes happens that people only include a "name" attribute forgetting about the id attribute.

eg:

<div name="divname" id="divname">content</div>
0
wilsonrxAuthor Commented:
Hi Norush

The two elements in the parent page are as follows :

<img id="cbImgThumb" src="" style="display:none" />
<input name="ctl00$cphMain$txtImageId" type="text" id="ctl00_cphMain_txtImageId" class="hiddenfield" />

Thanks
Rob.
0
NorushCommented:
I have tried the situation with the following attached files. (rename them to .htm)

I got no problems. Even if i set security to medium-high in IE 7.

I dont know of any solition other than putting them in the same domain which you already did.

I'm sorry wilsonrx
test.txt
open.txt
0
Cloud Class® Course: Amazon Web Services - Basic

Are you thinking about creating an Amazon Web Services account for your business? Not sure where to start? In this course you’ll get an overview of the history of AWS and take a tour of their user interface.

wilsonrxAuthor Commented:
You're quite right, Norush.  I have tried both of your pages and they work fine so there must be something else going on here.  Oh well, back to the drawing board.
0
NorushCommented:
Good luck and let us know an result !
0
wilsonrxAuthor Commented:
Well, its totally bizarre.  I stripped out all of those javascript commands and added them back in one-by-one to see which was causing me problems.

Lo and behold it worked.

Not only that but when I compare the original and the fixed one - they are the same.

So this is fixed, thanks for your help - but I have no idea how I fixed it!
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
NorushCommented:
Yeah those thing do happen sometimes. Fixing something by doing exactly the same as before :)

Anyhow good luck !
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
.NET Programming

From novice to tech pro — start learning today.