Last post Jul 30, 2007 11:47 AM by slyttle
Jul 27, 2007 05:45 PM|slyttle|LINK
I'm writing an asp.net application that runs inside a larger classic asp framework. My asp.net application is contained within an
iframe on the classic asp page.
In order to avoid scroll bars appearing on the iframe we want to size it to the exact height of the asp.net program .... the rub is that the height is variable.
onload event of the iframe
<iframe ID="myFrame" name="myFrame" width="100%" href="http:\\server.domain\myprogram\default.aspx" onload="adjustmyheight()"> <\iframe>
adjustmyheight() would look at the scrollheight of the document inside the iframe and adjust the height accordingly.
var iframeElement = document.getElementById("myFrame");
iframeElement.height = document.frames["myFrame"].document.body.scrollHeight;
This works fine if you are calling another classic ASP or pure HTML page, but unfortunately it appears that this isn't possible when referencing an asp.net application ... presumably because it is managed code ... I just get an "Access Denied"
error on the object.
I've tried all sorts of simple formatting things like height="100%" and style="overflow-y:visible" .... nothing seems to work.
Perhaps there is a fancy client-side scripting way of solving this from the ASP.NET side ... perhaps by looking back at the parent document and adjusting the external iframe from within managed code ... not sure.
Any suggestions would be greatly appreciated.
Jul 28, 2007 01:05 AM|triggered|LINK
document object model (DOM). But when the child is from a different domain, the child can no longer access the parent's internals, nor can the parent access the child's internal elements. This is set as a property in IE, to allow or not allow cross-site scripting
Jul 28, 2007 07:13 AM|slyttle|LINK
In this this case I am not sure that is the problem because everything should be on the same server ....
I'm going to try a few experiments with accessing the parent (Classic ASP) from the child (the ASP.NET app) this weekend and report back.
Jul 28, 2007 10:02 AM|A1ien51|LINK
Jul 30, 2007 11:47 AM|slyttle|LINK
Fantastic ... this solved my problem ! My classic asp was on
www.domain1.com and my asp.net app was on server.domain1.com so I just used your suggestion to force the domain to domain1.com for both of them and everything worked fine!