Popup Window Widget

current release: v1.0.0

How it works - widgets.popup([url], [name], [features], [debug])

The Popup Window Widget extends the default functionality of window.open(url, name, features) with the ability to process name and features from powerful custom profiles. Profiles are an efficient method of dealing with repeated code, especially in arguments.

Consider the need for several popup windows that have the same features in common. A custom profile can be used as an argument to widgets.popup(this, 'profiles.name') that produces the same popups without repeating the features arguments. Popup Window Widget takes this concept a little further by allowing the programmer to extend or overwrite a profile using similar markup: widgets.popup(this, 'profiles.name', 'width=100,height=100').

Profiles are created within the JavaScript code enclosure (limits polluting the window scope) and follow the format: profiles.[name].name (string) and profiles.[name].features (string).

Popup Window Widget Properties
Arguments Type Description
url mixed The popup url or object containing an href. Example: Use object [this] or string 'http://www.google.com'
name mixed The popup name or profile name (prefixed with "profiles.") Example: 'profiles.video'
features string The features as a comma separated key=value list
debug bool Set to true to disable opening the popup thru window.open() while testing
Properties Type Description
return false  
Profiles Type Description
profiles object The object containing the popup properties
profiles.name string The popup window's name
profiles.features string The popup window's features


Include Dependencies

<script type="text/javascript" src="javascript/popup.js"></script>

Call widgets.popup([url], [name], [features]) from any element or function

<a href="http://www.google.com" onclick="return widgets.popup(this, 'profiles.smallbox', 'width=800,height=600');">Google.com</a>

Try it out: Google.com


Basic Example

Popups with Object and Window Name


widgets.popup(this, 'MyName');

Popups with String and Window Name


widgets.popup(this.href, 'My Name');

Popups with Object, Window Name, and Features

widgets.popup(this, 'video', 'width=300px,height=500px');

Popups with Object and Profiles

widgets.popup(this, 'profiles.smallbox');

widgets.popup(this, 'profile.smallbox');

widgets.popup(this, 'profiles.video');

widgets.popup(this, 'profiles.notreal');

widgets.popup(this, 'profiles.notreal', 'width=100, height=100');

Profile plus Overriding Features

widgets.popup(this, 'profiles.video');

widgets.popup(this, 'profiles.video', 'width=100px,height=100px');

widgets.popup(this, 'profiles.video', 'width=100px,height=100px,tango=120px');


Window object tests




Test Results:

Console Based Benchmark Tests (x 10,000)

Basic object popup(this)

Basic string popup(this.href)

Profile popup(this, "profiles.basic")

Invalid Profile popup(this, "profiles.noprofile")

Profile+Features popup(this, "profiles.basic", "width=100, height=100")

Latest Source


Documentation was last modified on 25 October 2011 at 11:51 PM
4.08.2010 Version 1.0.0
Initial Release