mkdynamic/jquery-popupwindow — pull request #12 by thorst (2014-04-21 13:14:57+00:00)
Title: Add force refresh

To allow users to bring focus to an existing popup without causing the window to refresh.

Current behavior:
Clicking on a link to open a pop up that happens to already exist will cause that window
to refresh. This has the potential for users to lose unsaved work, or lose the current
URL if it was different from the initial one they were presented with.

I chose the name `forcerefresh` to define this current behavior. In my opinion this should
be defaulted to false, but in order to maintain backwards compatibility I set it to true.
With `forcerefresh` disabled it will allow users to just have the pop up brought into focus
without the refresh if it exists. If it doesn't exist, the pop up will be created and given
focus.

In order to use this feature to work the user needs to pass a name for that window, and toggle
`forcerefresh` off.

An example of use:
With a help desk system, users may need to be working on multiple tickets simultaneously.
With this requirement a modal is out of the question. If a user clicks on a ticket link in the
main window a pop up is displayed, which will allow users to modify its contents. Using
`forcerefresh:false` the developer can ensure that when the user clicks on that same
ticket link they will be presented with the existing pop up but without losing any modifications
they have completed, but not saved.

An alternative:
In this pull I define a global array of window handles that gets attached to the $.popupWindow
object. I believe this adds speed and is cleaner. However, its not necessary in order to regain a
reference to an existing pop up. Essentially the same functionality could be had with just the
following lines. The downside to not having a local array of handles, specifically in chrome,
are the pop ups with different origins and no user interaction.

```
$.popupWindow.win[winPOS].win = window.open("", name, params.join(','));
try { winHref = $.popupWindow.win[winPOS].win.location.href; } catch (e) { }
```