I'm trying to call a web page hosted on another domain on a iFrame inside a web resource. I'm getting the Access Denied error when the page is trying to use the jQuery code under his code. I've been searching the web and a found some ways that didn't worked for me.
On a side note: If a run this on FireFox it works perfectly.
Thanks so much
<HTML><HEAD>
<STYLE type=text/css>
html, body, iframe { width: 100%; height: 5000px }
</STYLE>
<SCRIPT language=javascript type=text/javascript>
function load() {
try {
var userId = window.parent.Xrm.Page.context.getUserId();
var codigoVendedor;
var url;
var filtro = "ln_name eq 'PortalConsultas'";
var userName;
var desde = GetDay(-2);
var hasta = GetDay(1);
var result = ODataSelect('ln_links', 'ln_Url', filtro, null, false, false);
if (result != null) {
url = result['ln_Url'];
} else {
document.getElementById("SinDatos").innerHTML = 'No hay definido un link con el nombre PortalConsultas';
return;
}
filtro = "SystemUserId eq guid'" + userId + "'";
result = ODataSelect('SystemUser', 'ln_codigodevendedor,FullName', filtro, null, false, false);
codigoVendedor = result['ln_codigodevendedor'];
userName = result['FullName'];
if (codigoVendedor == '' || codigoVendedor == null) {
url = url.replace('?fechaDesde={fechaDesde}&fechaHasta={fechaHasta}&EjeId={EjeId}', '');
} else {
url = url.replace('{EjeId}', codigoVendedor);
url = url.replace('{fechaDesde}', desde);
url = url.replace('{fechaHasta}', hasta);
}
document.getElementById("SinDatos").innerHTML = "Cargando reporte....";
document.getElementById('iframe').src = url;
} catch (e) {
alert(e);
}
}
</SCRIPT>
<META charset=utf-8></HEAD>
<BODY style="ZOOM: 1" onload=load();>
<DIV id=SinDatos>Cargando reporte....</DIV><IFRAME id=iframe src="http://calendarnew.lanacion.com.ar/Buscador_mediciones.aspx" frameBorder=0 scrolling=yes></IFRAME></BODY></HTML>
In the properties window for the HTML web resource (within the form editor), is the checkbox "Restrict cross-frame scripting" checked or not checked? You will sometimes get Access Denied if the code crosses over to a different Web domain and if the setting I mentioned above is enabled.