• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 1102
  • Last Modified:

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.
0
wilsonrx
Asked:
wilsonrx
  • 4
  • 3
1 Solution
 
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
The new generation of project management tools

With monday.com’s project management tool, you can see what everyone on your team is working in a single glance. Its intuitive dashboards are customizable, so you can create systems that work for you.

 
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
 
NorushCommented:
Yeah those thing do happen sometimes. Fixing something by doing exactly the same as before :)

Anyhow good luck !
0

Featured Post

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

  • 4
  • 3
Tackle projects and never again get stuck behind a technical roadblock.
Join Now