views:

1317

answers:

1

Hi there can anyone help, i have a developed a function that when called should open a window but it returns NULL. If i do the opening window in the original javascript function it works. I suppose its the original function passes control to the other function but for some reason this doesn't work..

Here is my original function, this basically calls a new javascript file and loads an HTML file and when "Ready" it needs to display the window.open with the html file which is now in the form of string.

order.prototype.printMe = function(){
    order_resume.loadthis("myTestPage.html", "showData");

    // OPENING WINDOW HERE WORKS; but the the html file that is loaded
    // in above line hasn't finsihed loading - so i need to show it form
    // the fucntion below once in "ready" state 

/*     child1 = window.open ("about:blank","_blank");
     child1.document.write( myDocument );
     child1.document.close();
*/   
}

and heres is my fucntion that is called from original function

function showResume(){
this.req = false;

reservaResumen.prototype.showData = function(){
 if (this.req.readyState == 4) {
   child1 = window.open("about:blank", "_blank");  /// THIS RETURNS NULL
   child1.document.write("test");
   child1.document.close();
 }
}

reservaResumen.prototype.loadthis= function(url, myMethod){
 if (window.XMLHttpRequest && !(window.ActiveXObject)) {
  try {
   this.req = new XMLHttpRequest();
  } 
  catch (e) {
   this.req = false;
  }
 }
 else 
  if (window.ActiveXObject) {
   try {
    this.req = new ActiveXObject("Msxml2.XMLHTTP");
   } 
   catch (e) {
    try {
     this.req = new ActiveXObject("Microsoft.XMLHTTP");
    } 
    catch (e) {
     this.req = false;
    }
   }
  }
 if (this.req) {
  var loader = this;
  this.req.onreadystatechange = function(){
   eval("loader." + myMethod+ ".call(loader)")
  }
  this.req.open("GET", url, true);
  this.req.send("");
 }
}
A: 

See this discussion thread that attributes this issue to the 32 bit IE8 browser running on 64bit Windows 7.

I just ran into this a few days ago. My development machine started to behave differently, popup windows no longer work on many sites, including the one that I develop, and there is no fix in sight. I have to start IE as administrator, then it works. Disabling protected mode does not resolve this. The 64 bit browser does not have this issue.

Why in my case this just started a few weeks ago I cannot say. There was a security update on 9/16 that I suspect caused the change in behavior. This is very odd.

cdonner