Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6934133
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T11:55:16+00:00 2026-05-27T11:55:16+00:00

I have a parent page which has an iframe and also has javascript which

  • 0

I have a parent page which has an iframe and also has javascript which will create a form, append it to the iframe, and submits it via POST to an external URL upon page load.

The content from the external URL then loads in the iframe. This works fine in all browsers EXCEPT IE9.
I tried the 'meta http-equiv="X-UA-Compatible" content="IE=8" ' trick and this didn’t help. Sometimes the iframe renders the content, sometimes it doesn’t upon refresh. Debug statements in the javascript show it is firing each time (each page load) and Fiddler shows the successful request/response to the external URL. It’s as if IE9 selectively decides whether to update the DOM.

Also I’ve noticed is that if there is any sort of delay with the external request (taking a few seconds), then the iframe content never renders. Has anyone experienced this with IE9 and have a solution?

<iframe frameborder="0" height="600px" id="ifPage" runat="server" width="700px" />

<script type="text/javascript" language="javascript">
var alreadyrunflag = 0 //flag to indicate whether target function has already been run

if (document.addEventListener) {//FireFox or Sarafi
    document.addEventListener("DOMContentLoaded", function () { alreadyrunflag = 1; GetExternalPageContent() }, false)
}
else if (document.all && !window.opera) 
{//IE
    addLoadEvent(GetExternalPageContent)
}

function addLoadEvent(func) {
    var oldonload = window.onload;
    if (typeof window.onload != 'function') {
        window.onload = func;
    }
    else {
        window.onload = function () {
            if (oldonload) {
                oldonload();
            }
            func();
        }
    }
}

function GetExternalPageContent() {

    var iframe = document.getElementsByTagName("iframe");
    if (iframe != null) {
        var uniqueString = "embFrame";
        iframe[0].contentWindow.name = uniqueString;
        var form = document.createElement("form");
        form.target = uniqueString;
        form.action = '<%=ExternalUrl %>';
        form.method = "POST";

        //parameter submitted to external URL to get appropriate content  
        var input = document.createElement("input");
        input.type = "hidden";
        input.name = "embParam";
        input.value = "paramValue1";
        form.appendChild(input);

        document.body.appendChild(form);
        form.submit();
    }
}
</script>
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-27T11:55:16+00:00Added an answer on May 27, 2026 at 11:55 am

    I just wanted to let people know that the issue here is that IE doesn’t like naming of the iframe content window like this:

    iframe[0].contentWindow.name = uniqueString
    

    Instead, the name attribute must be within the iframe tag itself. There were no javascript errors indicating this, it just didn’t consistently render. Then, when you need to dynamically reference the iframe content, use:

    var iframe = window.frames['embFrame']
    

    Doing it this way solved the issue and now the iframe content is rendered consistently.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have an aspx master/content page scenario. The parent page has an IFrame which
I have a dynamic page which has a parent div called 'divWiz' where I
I have a html page which has animations which will play over time, i
I have this script on my html page: <script language='javascript'>parent.resizeTo(550,510);</script> I'd like to add
I have a parent object which has a one to many relationship with an
I have a page that is already in an iframe that has another page
I have a page that has an embedded iframe doing ajax requests.... when i
Here is a problem I have encountered. I have jsp page which has a
I have a page with 3 different frames which form a complete grid ..
I have a page which needs to use $.post() but for some reason the

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.