views:

70

answers:

2

Hi,

I got this code for my sharepoint, but I get a Access is Denied, can anyone help me out here ?

<!-- Load and display list - iframe version -->
<!-- Questions and comments: [email protected] -->

<DIV id="ListPlaceholder"><IMG src="/_layouts/images/GEARS_AN.GIF"></DIV>

<!-- Paste the URL of the source list below: -->
<iframe id="SourceList" style="display:none;" src="xXxXxX" onload="DisplayThisList()"></iframe>

<script type="text/javascript">
function DisplayThisList()
{
var placeholder = document.getElementById("ListPlaceholder");

var displaylist = null;
var sourcelist = document.getElementById("SourceList");

try {
   if(sourcelist.contentWindow)
      // Internet Explorer
      {
        displaylist = sourcelist.contentWindow.document.getElementById("WebPartWPQ1") ;
      }

}
catch(err)
{ 
    alert(err.message);
}

displaylist.removeChild(displaylist.getElementsByTagName("table")[0]);

placeholder.innerHTML = displaylist.innerHTML;
}
</script>
A: 

Is by any chance the iframe loading something from another domain? You can't access the contents of the iframe if it is (for security reasons).

axel_c
I will try and look at Fiddler.and it is just loading a list from another sharepoint site, so it is the same domain.
Lasse Gaardsholt
+1  A: 

I found the errror, our sharepoint had multiply names to be access on, so I just changed the URL so it was more dynamic.

Lasse Gaardsholt