1

I have a div with id="icontainer" in my web page and when the user clicks on it a new url opens in a new tab and the user stays there in the new tab.

How it is possible when the user clicks on my div the new url is opening in background of the browser, or a new tab, but the user remains in my web page?

My code:

<script type="text/javascript">
$(document).ready(function() {
    $("#icontainer").click(function() {
        $("#icontainer").hide();
        var link = 'http://www.youtube.com/42/16022/15176/" alt="" border="0">';
        var mer_window = window.open(link, '_blank', 'toolbar=1,location=1,directories=1,scrollbars=1,resizable=1,status=1,menubar=1');
    });
});
</script>
Beetroot-Beetroot
  • 18,022
  • 3
  • 37
  • 44
Irene T.
  • 1,393
  • 2
  • 20
  • 40

1 Answers1

0

This is called a popunder. I highly recommend you dont do this. I have never seen a good reason to do this.

If need be, heres a site explaining the code.

Vanilla http://www.htmlgoodies.com/beyond/javascript/article.php/3471241/So-You-Want-A-Pop-Under-Window-Huh.htm

jQuery https://github.com/hpbuniat/jquery-popunder

JuanT
  • 176
  • 6