Bug 12708 - Unexpected behaviour in IE 9 and lower when using openWindow
Summary: Unexpected behaviour in IE 9 and lower when using openWindow
Status: CLOSED FIXED
Alias: None
Product: Koha
Classification: Unclassified
Component: Templates (show other bugs)
Version: Main
Hardware: All All
: P5 - low normal (vote)
Assignee: David Cook
QA Contact: Testopia
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2014-08-04 03:42 UTC by David Cook
Modified: 2015-06-04 23:32 UTC (History)
3 users (show)

See Also:
Change sponsored?: ---
Patch complexity: Small patch
Documentation contact:
Documentation submission:
Text to go in the release notes:
Version(s) released in:


Attachments
Bug 12708 - Unexpected behaviour in IE 9 and lower when using openWindow (5.19 KB, patch)
2014-08-04 04:06 UTC, David Cook
Details | Diff | Splinter Review
[Signed-off] Bug 12708 - Unexpected behaviour in IE 9 and lower when using openWindow (5.48 KB, patch)
2014-08-06 15:32 UTC, Marc Véron
Details | Diff | Splinter Review
[PASSED QA] Bug 12708 - Unexpected behaviour in IE 9 and lower when using openWindow (5.69 KB, patch)
2014-08-15 20:44 UTC, Katrin Fischer
Details | Diff | Splinter Review

Note You need to log in before you can comment on or make changes to this bug.
Description David Cook 2014-08-04 03:42:19 UTC
Currently, we use a Javascript function called "openWindow" in staff-global.js as a bit of a helper function for executing "window.open".

Well, there is a problem with the "name" argument when using IE 9 and lower. If the "name" has a space or certain punctuation (NOT including underscores), it'll throw an error which causes unexpected behaviours.

For instance, if you open "Help" in the staff client using IE 9 or lower, it'll open the help page into the current window rather than a pop-up, which is far from desirable.

I've noticed after a few greps that we usually use an alphabetic string with no spaces or punctuation when using the "name" parameter for window.open. According to Mozilla (https://developer.mozilla.org/en-US/docs/Web/API/Window.open), this is the recommended way of writing a "name".

There are only a few instances where "openWindow" seems to use a string containing spaces for "name". 

The best thing to do is probably fix those instances as well as add a try/catch in openWindow for times where someone makes a mistake.
Comment 1 David Cook 2014-08-04 04:06:36 UTC Comment hidden (obsolete)
Comment 2 Marc Véron 2014-08-06 15:32:19 UTC Comment hidden (obsolete)
Comment 3 Katrin Fischer 2014-08-15 20:44:28 UTC
Created attachment 30866 [details] [review]
[PASSED QA] Bug 12708 - Unexpected behaviour in IE 9 and lower when using openWindow

This patch removes the whitespace from arguments to the "name" parameter
in "window.open". It also adds a trap for the "openWindow" helper
function, which will use a "null" instead of a "name" if window.open
isn't able to handle a name with whitespace (i.e. if it's IE <= 9).

_TEST PLAN_

1) Switch to an emulated or authentic Internet Explorer version E 9
or lower
2) Click "Help"
3) Note that it opens the page in the current window rather than as a popup

4) Apply the patch

5) Shift refresh your page
6) Click "Help"
7) Note that it now opens (correctly) as a pop-up

(If you want to be more thorough, you can test in other browsers as well
to make sure that it still works.)

Tested with IE 10 developer tools: IE7, IE 8, IE 9
Window pops up as expected. No regression found with IE 10 / FF31.0
Signed-off-by: Marc Véron <veron@veron.ch>

Signed-off-by: Katrin Fischer <Katrin.Fischer.83@web.de>
Tested for regressions in Firefox and Chromium.
I checked the help and the duplicate authorities windows
still work correctly.
Passes tests and QA script.
Comment 4 Tomás Cohen Arazi 2014-08-19 12:35:29 UTC
Patch pushed to master.

Thanks David!