README.md
December 4, 2022 ยท View on GitHub
Description
My article shows you how to create a popunder window using scripting.
More Info
| Submitted On | |
| By | Mike Thompson |
| Level | Intermediate |
| User Rating | 5.0 (20 globes from 4 users) |
| Compatibility | |
| Category | Internet/ Browsers/ HTML |
| World | Java |
| Archive File |
Source Code
Creating a popunder window
I feel guilty writing this tutorial, but as the saying goes, "give the people what they want", or to be more precise, developers. A lot of developers would like to know how to implement popunder 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 popunder window is very simple, by using Javascript. Basically one would use the same method for creating a popup window, but then "unfocus" 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 popunder instead.
You can even customize the pop under window so certain standard features are removed, like the toolbar, or configure the window's size. Here's an example of each:
<script>
win2=window.open("http://www.msn.com","",toolbar=0)
win2.blur()
window.focus()
</script>
<script>
win2=window.open("http://www.msn.com","","width=500,height=250")
win2.blur()
window.focus()
</script>
You've probably seen more sophisticated popunder scripts that control the "frequency" of the popunder, 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.