This project is read-only.

How do I pass the QueryString to an IFrame hosted on a content page?

Topics: Customizing Orchard, Troubleshooting, Writing modules
May 23, 2011 at 5:14 PM


We want to host our intranet apps inside of Orchard.  I've created a content page with an IFrame that points to the site, but I'm not sure of the best way to get the URL of the IFrame to have the same QueryString as the browser.  Is a custom module going to be required?



May 23, 2011 at 9:26 PM
Edited May 23, 2011 at 9:27 PM

I was able to get this working...  Here are the sites that helped along the way:


Here's the code I ended up with on my content page:


<iframe allowtransparency="true" width="100%" frameborder="0" height="475" name="ServiceDeskContentFrame" 
id="ServiceDeskContentFrame" src="javascript:'<html></html>';" onload="resizeIframeToFitContent(this)" ></iframe>

function resizeIframeToFitContent(iframe) {
//NOTE:  Edit this only with TinyMCE disabled in the modules section.
//I'm not sure why, but it won't work otherwise.
    // This function resizes an IFrame object
    // to fit its content.
    // The IFrame tag must have a unique ID attribute.
    iframe.height = document.frames[]

function loadIframe(iframeName, url) {
//alert("about to get ref to frame using frames array");
    if ( window.frames[iframeName] ) {
//alert("got ref to frame using frames array");
        window.frames[iframeName].location = url;   
        return false;
//alert("frame not found");
    return true;

function changeIframeSrc(id, url) {
//alert("about to get ref to frame");
    var el = document.getElementById(id);
//alert("got ref to frame");
    if (el && el.src) {
//alert("frame found");
        el.src = url;
        return false;
//alert("frame not found");
    return true;

//document.domain = "http://erp/";

if( == 0)
//alert("length = 0");
window.frames["ServiceDeskContentFrame"].location = "http://erp/development/nsgtech/default.aspx";
//alert("show ticket");
var url = "http://erp/development/nsgtech/viewticket.aspx" +;
//loadIframe("ServiceDeskContentFrame", url);
changeIframeSrc("ServiceDeskContentFrame", "http://erp/development/nsgtech/viewticket.aspx" +;