Creating a pop-under Window






2.28/5 (15 votes)
This tutorial shows you how to create a popunder window using JavaScript
Introduction
I feel guilty writing this tutorial, but as the saying goes, "give people what they want", or to be more precise, developers. A lot of developers would like to know how to implement pop-under windows on their site as a way to broadcast advertising. Yes, it's annoying for the visitor, but proven quite effective in getting attention.
Creating a pop-under window is very simple, by using JavaScript. Basically, one would use the same method for creating a popup window, but then "un-focus" it. Here is the code in full force:
<script>
win2=window.open("http://www.msn.com")
win2.blur()
window.focus()
</script>
That's it! I open a window by invoking window.open()
, blur it, then redirect the focus to the main window instead. Translation - the popup window becomes a pop-under instead.
You've probably seen more sophisticated pop-under scripts that control the "frequency" of the pop-under, such as popping up only once per browser session. Instead of reinventing the wheel, I'll simply point you to a nice example of this on JavaScript Kit: http://javascriptkit.com/script/script2/popunder.shtml
Have fun with popping under your windows.