Click here to Skip to main content
15,893,904 members
Articles / Programming Languages / Javascript

Creating a pop-under Window

Rate me:
Please Sign up or sign in to vote.
2.28/5 (15 votes)
26 Dec 2001CPOL 199.2K   38   25
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:

JavaScript
<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.

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


Written By
Web Developer
United States United States
This member has not yet provided a Biography. Assume it's interesting and varied, and probably something to do with programming.

Comments and Discussions

 
SuggestionUnblockable popunder Pin
Member 1009963515-Jul-14 12:32
Member 1009963515-Jul-14 12:32 
GeneralCute Cool Pop-Ups Pin
ravindu_d15-Aug-07 15:59
ravindu_d15-Aug-07 15:59 
GeneralPopUnder arent always bad Pin
Seth Illgard8-Feb-07 17:06
Seth Illgard8-Feb-07 17:06 
Generalalert box in javascript Pin
PrakashBhaskar16-Jun-06 2:42
PrakashBhaskar16-Jun-06 2:42 
GeneralRe: alert box in javascript Pin
JeevaBharathi15-May-07 23:33
JeevaBharathi15-May-07 23:33 
Generalpopup - very urgent Pin
deulu31-Oct-05 20:49
deulu31-Oct-05 20:49 
GeneralRe: popup - very urgent Pin
wuxsh18-Jan-06 13:33
wuxsh18-Jan-06 13:33 
GeneralRe: popup - very urgent Pin
ravindu_d15-Aug-07 14:00
ravindu_d15-Aug-07 14:00 
GeneralSome Good Resources Pin
Anonymous19-Aug-05 17:33
Anonymous19-Aug-05 17:33 
GeneralRe: Some Good Resources Pin
ravindu_d15-Aug-07 14:14
ravindu_d15-Aug-07 14:14 
GeneralPopup window issues... Pin
BBWS1O6-Jun-05 9:54
BBWS1O6-Jun-05 9:54 
GeneralRe: Popup window issues... Pin
Brad Frere17-Jan-07 11:14
Brad Frere17-Jan-07 11:14 
Generalclose window Pin
yonghui1-Apr-04 16:10
yonghui1-Apr-04 16:10 
GeneralRe: close window Pin
Anonymous3-May-04 2:36
Anonymous3-May-04 2:36 
GeneralRe: close window Pin
ravindu_d15-Aug-07 14:11
ravindu_d15-Aug-07 14:11 
GeneralCode snippet Pin
alex.barylski29-Jan-04 18:20
alex.barylski29-Jan-04 18:20 
QuestionHow to develop a deeptree bar? Pin
W. Cheung22-May-03 18:48
W. Cheung22-May-03 18:48 
AnswerRe: How to develop a deeptree bar? Pin
ravindu_d15-Aug-07 14:23
ravindu_d15-Aug-07 14:23 
GeneralPopup window Pin
Quintonvz24-Apr-03 1:48
Quintonvz24-Apr-03 1:48 
GeneralPop-up Window Eliminator Pin
cpan200019-Jul-02 3:06
cpan200019-Jul-02 3:06 
Questionan unpopular topic eh? Pin
Nish Nishant28-Dec-01 19:34
sitebuilderNish Nishant28-Dec-01 19:34 
AnswerRe: an unpopular topic eh? Pin
Jörgen Sigvardsson7-Oct-02 20:34
Jörgen Sigvardsson7-Oct-02 20:34 
GeneralRe: an unpopular topic eh? Pin
Anonymous12-Feb-04 8:46
Anonymous12-Feb-04 8:46 
GeneralRe: an unpopular topic eh? Pin
Jörgen Sigvardsson12-Feb-04 9:25
Jörgen Sigvardsson12-Feb-04 9:25 
GeneralRe: an unpopular topic eh? - test Pin
Anonymous12-Dec-04 5:38
Anonymous12-Dec-04 5:38 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.