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: I've create an alternative in #13. Check that out and determine which you would like to inlcude.
Could this be expedited if I added it to the sample page?
There I added a sample. Please visit this repo and download it and view the example.html.
The Open window (named with refresh) link simulated the existing behavior.
The Open window (named without refresh) demonstrates what the patch offers.
To test:
- Click the last two links
- Type "test" into google search box in both pop ups
- Click last two links again
You will see the one with forcerefresh disabled your page will still have the google search results. The other will be back to google.com.
Without this patch both pages would refresh back to google.com, and the user would have lost any work they had completed.
@mkdynamic Have you had a chance to look at this feature at all? Im about to implement this on another project and would like to pull from your main branch instead of having a custom build.
I prefer this over the alt version, as this is better at maintaining the window handles.