0

I'm using the following code to open the link in a new window, its working in IE8, Chrome and Opera, but in Firefox 6 it's opening in a new tab. How can I fix that?

var popupName;
function openPopup(href) {
    popupName = window
            .open(
                    href,
                    'Details',
                    'scrollbars=1,resizable=no,location=no,menubar=no,status=no,toolbar=no,width=700,height=710');
    popupName.focus();
    return false;
}
Mokus
  • 10,174
  • 18
  • 80
  • 122
  • New tab / new window - who cares? This is just the browser's implementation – m.edmondson Sep 16 '11 at 15:18
  • "Script opening a new window in Opera" ? are you serious ? – c69 Sep 16 '11 at 15:21
  • The script opens a non-maximized tab in Opera which has a title bar and close buttons so it really looks like a normal window to most users. – Luchs Sep 16 '11 at 22:50
  • 1
    http://stackoverflow.com/questions/16266039/how-to-open-a-link-in-new-window/38329689#38329689 see the example there and use window.open() fun. – Saurabh Sharma Jul 12 '16 at 13:05

3 Answers3

3

This is controlled by the user preferences in the browser itself. Correct me if I'm wrong, but I think this can not be altered.

Why would you like a new window anyway? Let the user decide (with the browser preferences) if it's a new window or a new tab.. Same effect, less annoyance.

Deep Frozen
  • 2,053
  • 2
  • 25
  • 42
1

If the customer is looking for something that "pops up" on top of other content, you might think of using some dialog framework that employs an IFRAME to load the detail page. For instance, FancyBox could do the thing (see example "Iframe (75% width and height)" in http://fancybox.net/ front page)

naivists
  • 32,681
  • 5
  • 61
  • 85
  • Yes, mostly I'm using colorbox, but he don't like that, he want a popup widows :). – Mokus Sep 16 '11 at 19:25
  • sorry, but then the answer is that nowadays the web does not allow the developer to choose how a windows open :( – naivists Sep 16 '11 at 19:27
-1

here is a pretty cool online tool that will generate a link for you http://www.echoecho.com/toolpopupgenerator.htm

I know he is not asking for a generator, but if he generates his code one time and studies it, he will understand how it works

sethportman
  • 203
  • 1
  • 3
  • 6