1

I have the following code, which I would like to open in a new Tab (assuming user options are set to have that as the preferred behavior):

var qaWindow = window.open('', 'proqa', null);

This is working fine in Chrome, but is opening a new window in FF and IE.

The reason I need to do it this way (without a url), is that I only want the page to load the first time it is opened. On subsequent calls, I need to call out to the window/tab without causing a reload.

The subsequent code looks like this:

if (qaWindow.location == "about:blank") {
    var url = "/chat/index/" + urlparams.id;
    qaWindow.location = url;
} else {
    qaWindow.callMe(urlparams.id);
}
qaWindow.focus(); 

Is there any way to accomplish both?

P̲̳x͓L̳
  • 3,615
  • 3
  • 29
  • 37
sydneyos
  • 4,527
  • 6
  • 36
  • 53
  • what window.open does it not able to be controlled by javascript, it can only be controlled by the browser and not much that can be done about it. – QBM5 Mar 26 '14 at 19:32
  • possible duplicate of [Opening url in new tab](http://stackoverflow.com/questions/6637419/opening-url-in-new-tab) – Patrick Evans Mar 26 '14 at 19:44
  • @QBM5 That is correct This answer http://stackoverflow.com/questions/726761/javascript-open-in-a-new-window-not-tab says you can but it quickly stopped working as browsers updated. You cannot guarantee whether it will be opened in a new window or tab – Ruan Mendes Mar 26 '14 at 19:45
  • Well, setting window properties does seem to pretty much guarantee a new window instead of a tab. And having _blank, which is more or less what's going on here, seems to cause it for FF and IE. But yes, guaranteeing that it follows the user preferences seems off the table, which is a real bummer. – sydneyos Mar 27 '14 at 01:07
  • @PatrickEvans - not exactly a duplicate. I'm aware of all the other posts. The slight difference is that I need to keep a reference to the open window and not refresh it. Otherwise, I could easily call window.open(url, windowname, null) every time and it would correctly target the same window, but it would refresh. – sydneyos Mar 27 '14 at 01:10

0 Answers0