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

  • SEARCH
  • Home
  • 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 522989
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T08:24:39+00:00 2026-05-13T08:24:39+00:00

I have a strictly browser based JavaScript and xlst application. It’s normally used on

  • 0

I have a strictly browser based JavaScript and xlst application. It’s normally used on a local machine, but is sometimes accessed via Apache.

The main page is content.html which gets its content changed dynamically. In one case, an href in one page opens a new window and eventually the following code gets executed which sets up an onready function, with the intention of getting the content of the new window built.

This works in almost all cases. It works in all cases for Firefox. And it even works in all cases for IE when running locally (e.g. file:///C:/Program%20Files/Apache%20Software%20Foundation/Apache2.2/htdocs/hlic/index.html).

My problem is that when accessed via Apache in IE, I just get a blank window. It’s acts like that the onready function is never fired. However, if I add an alert("fire"), the alert does get shown, after which, my window content does get displayed. So why does it only work with the alert? What else can I do to get the content to show up? Any help would be greatly appreciated.

Here’s the code:

/*
 *  PresentStreamInNewBrowser
 *
 *      Creates a new browser window and fills with
 *      provided content stream. Also sizes the
 *      window to either default dimensions or to any       
 *      supplied dimensions.
 *
 *      A close and a print button are added to the bottom 
 *      of the content stream.
 *
 *      Inputs:
 *          pageStream - content stream to display
 *              in new window.
 *          height, width, top, left - dimensions
 *              for the newly opened window. (optional)
 * 
 */ 
function Presenter_PresentStreamInNewBrowser( pageStream, height, width, top, left )
{
    // set the features
    var features  = "height=" + height;
        features += ",width=" + width;
        features += ",top=" + top;
        features += ",left=" + left;
        features += ",scrollbars=yes";
        features += ",resizable=yes";

    // open the window
    var presenter = this;
    var newWindow = window.open(
        app.NormalizeURI("deview/frames/content.html"), '', features );

    // the rest of the code executes when the content window
    // calls its onready function, after it has loaded
    newWindow.onready = function() {

    

        var doc = newWindow.document;

        // create stylesheet links if applicable
        for(var i = 0; i < pageStream.stylesheet.length; i++) {
            var linkElement = doc.createElement("link");
            linkElement.rel = "stylesheet";
            linkElement.href = pageStream.stylesheet[i];
            doc.getElementsByTagName("head")[0].appendChild( linkElement );
        }

        // insert content
        doc.body.innerHTML = "";
        doc.body.appendChild( pageStream.content.importIntoDocument(doc) );
        doc.body.appendChild( doc.createElement("br") );

        // Handle generation of special pages.
        presenter.AddGeneratedContent( doc );

        // add a close button
        var selectionString =
        "displayStrings/promptStrings/promptString[@id='close_button_anchor']";
        var buttontext = app.displayStringsDOM.selectSingleNode(
        selectionString ).firstChild.nodeValue;
        var closeButtonElement = doc.createElement("button");
        closeButtonElement.id = "closebutton";
        closeButtonElement.className = "addonbutton";
        closeButtonElement.onclick = "javascript:window.close()";
        closeButtonElement.value = buttontext;
        doc.body.appendChild( closeButtonElement );

        // add a print button
        selectionString =
        "displayStrings/buttonLabelStrings/buttonLabelString[@id='print_button_anchor']";
        buttontext = app.displayStringsDOM.selectSingleNode(
        selectionString ).firstChild.nodeValue;
        var printButtonElement = doc.createElement("button");
        printButtonElement.id = "printbutton";
        printButtonElement.className = "addonbutton";
        printButtonElement.onclick = "javascript:window.print()";
        printButtonElement.value = buttontext;
        doc.body.appendChild( printButtonElement );

        // close up shop
        newWindow.document.body.appendChild(
        newWindow.document.createElement("br") );
        newWindow.document.title = '-';

        // add some language dependent text
        presenter.AddButtonLabel( doc );
        presenter.AddExamLabels( doc );

        //alert("fire");
  }        
}
  • 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-13T08:24:40+00:00Added an answer on May 13, 2026 at 8:24 am

    You could perhaps try checking the document readyState, something like

    var newWindowReadyFired = false;
    
    newWindow.onready = function() {
      if (newWindowReadyFired) return; //just in case race condition got us in here twice   
      newWindowReadyFired = true;
    
      //....the rest of your event handler
    }
    
    function chkFunc() {
      if (newWindowReadyFired) return; //magic already done
    
      if (newWindow.document && newWindow.document.readyState == 4) {
        newWindow.onready();
      } else {
        setTimeout(chkFunc,"100"); //wait and try again
      }
    }
    chkFunc();
    

    Can’t guarantee this will work, but perhaps worth a try?

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

Sidebar

Related Questions

I currently have a web based application which strictly relies on a 3rd party
(Not strictly programming, but a question that programmers need answered.) I have a benchmark,
I have a question which is not strictly-speaking programming related, but nevertheless caused by
I have a link on my site that is strictly JavaScript, that the users
I have strictly separated the layers between different parts of my Android application. At
I know this isn't strictly a programming question but y'all must have experienced this.
If you have a set of tables in the database that strictly consist of
I have some old C# plugin code that was implemented strictly with Reflection. In
We have some PL/pgSQL stored procedures in our DB (PostgreSQL 9.x). These are strictly
I don't know if this is strictly a programming question but here goes. I

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.