2

Possible Duplicate:
How to tell browser to stay on current window

In this code I have an onclick that calls a function load_window()to do a window.open.

Here is the HTML

<div id="id01" class="channel" onclick="load_window('http://www.ewtn.com')"><a>EWTN.com</a></div><br/>EWTN television network</div>

The code for that function is this.

function load_window(url) {
    $.ajax({ 
        url : "fileinfo.php", 
        dataType: "html", 
        success : function (data) { 
            $('#layer').css('visibility','hidden');
        } 
    });

    // Pause first then open window
    function pause_first (url) {
        var external_window = window.open(url,'_blank');
        external_window.focus();
        alert ('window first');
    }

    var pause_ret = setTimeout( function() { pause_first(url); }, 1500);

}

Because the browser recognizes that the window.open was not from user action it does not perform that action. Is there a different way to do this.

At this url you will find the page where I want to do this: webfiles.comze.com.

Click on EWTN and the browser should take you to that web page. I'd like the browser to pause 2 seconds before doing that to tell the user that he is leaving the site and to show him the location for EWTN.

Community
  • 1
  • 1
user823527
  • 3,644
  • 17
  • 66
  • 110

1 Answers1

1

Browser detects this as a popup and does whatever browser does with popups. I was trying to get an answer for very similar question but looks like there is no way around it.

window.open(url) different behavior - same code, different timing

Community
  • 1
  • 1
sha
  • 17,824
  • 5
  • 63
  • 98