0

I am trying to make a popup a window under an active window tab but when i do it opens a new tab and lose focus. What I am trying to do is open a new popup window/tab but the focus on the parent window remains

function displaypop() {

    var url = 'http://www.google.com';
    var windowName = "popUp"; //$(this).attr("name");
    var mypopup = window.open(url, windowName, "height=200,width=200");
    mypopup.blur();
    window.focus();


 }
JeVic
  • 681
  • 1
  • 11
  • 33
  • That's not for you to choose, this stuff gets configured in the browser settings, how the user wants the browser to act when new window's is opened. – Asons Sep 23 '15 at 10:14
  • possible duplicate of [Open a URL in a new tab using JavaScript](http://stackoverflow.com/questions/4907843/open-a-url-in-a-new-tab-using-javascript) – Asons Sep 23 '15 at 10:16

1 Answers1

0

You can achieve this using javascript. Not a pretty solution though.

        var win = window.open("/apex/PopupWindow", "PopupWin", "height=500,width=500");
        // set the focus new window
        win.focus();
        // assign the methods focusPopup to the window events that may cause it to loose focus
        window.onmousedown = focusPopup;
        window.onkeyup = focusPopup;
        window.onmousemove = focusPopup;

        function focusPopup() {
            if (win && !win.closed) {
                win.focus();
            }
        }
Rishi Ravindran
  • 155
  • 1
  • 5