Blue Waters
Blue Waters

Reputation: 725

How To Create a Popup Window from Internet Explorer 9

I'm using the following to attempt to create a popup in IE 9

function popUp(url) {
  day = new Date();
  id = day.getTime();
  eval("page" + id + " = window.open(url,'" + id + "','toolbar=0,scrollbars=1,location=0,statusbar=0,menubar=0,resizable=1,width=600,height=520,left = 400,top = 200');");
  return false;
}

This works fine in Chrome, Firefox and Safari - but IE 9 refuses to open a popup - instead opening the url in a new tab. I've disabled the popup blocker in IE9 - but the function above still opens the url in a new tab and not in a popup.

Any suggestions on how to get IE9 to 'popup'?

Upvotes: 4

Views: 19359

Answers (2)

Wayne
Wayne

Reputation: 31

when the user has 'Let Internet Explorer decide how pop-ups should be open' which is the default, setting resize=yes will make IE9 open a tab and resize=no will allow the popup. this might be the same with other attributes i haven't tested.

Upvotes: 3

Aleks G
Aleks G

Reputation: 57316

This code seems to work in IE9 (just checked - opens a new window, not a tab):

function popUp(url) {
  day = new Date();
  id = day.getTime();
  eval("page" + id + " = window.open(url,'" + id + "','_blank','toolbar=0,scrollbars=1,location=0,statusbar=0,menubar=0,resizable=1,width=600,height=520,left = 400,top = 200');");
  return false;
}

I think it may have something to do with indicating the window name, which is different from the existing window.

Upvotes: 3

Related Questions