Bug 11937

Summary: opac link doesn't open in new window
Product: Koha Reporter: Nicole C. Engard <nengard>
Component: TemplatesAssignee: Juan Romay Sieira <juan.sieira>
Status: CLOSED FIXED QA Contact: Marcel de Rooy <m.de.rooy>
Severity: minor    
Priority: P5 - low CC: abbyrobertson.student, arm, brendan, cbrannon, chris, david.roberts, eb, jdemuth, juan.sieira, julian.maurice, katrin.fischer, koha, liz, m.de.rooy, meteolib, mirko, mtj, nick, timdhannah, veron
Version: masterKeywords: Academy
Hardware: All   
OS: All   
See Also: http://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=11890
http://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=13644
Change sponsored?: --- Patch complexity: Small patch
Documentation contact: Documentation submission:
Text to go in the release notes:
Version(s) released in:
Attachments: browser.js changed to modify all the links but not the target _blank
Bug 11937 - opac link doesn't open in new window
Bug 11937 - opac link doesn't open in new window

Description Nicole C. Engard 2014-03-13 17:32:18 UTC

    
Comment 1 Nicole C. Engard 2014-03-13 17:33:35 UTC
Hit enter too fast.

On the staff detail page there is a link to open the opac view in a new window. It used to open in a new window, now it doesn't. I checked the code:

    [% IF ( OpacUrl ) %]
        <li><strong>OPAC view:</strong>
    	<a href="http://[% OpacUrl %]/cgi-bin/koha/opac-detail.pl?biblionumber=[% biblionumber %]" target="_blank">Open in new window</a>
		</li>
	[% END %]

and the resulting page code:

<span class="results_summary"><span class="label">OPAC view: </span><a href="http://kohavm/cgi-bin/koha/opac-detail.pl?biblionumber=4091" target="_blank">Open in new window</a>.
        </span>

Both have the target="_blank" so what's stopping it from opening in a new window?
Comment 2 Owen Leonard 2014-03-14 13:09:25 UTC
I was able to reproduce this bug only with my Windows Firefox installation when my regular addons were enabled. When I tried it with addons disabled it worked as expected. That suggests to me that this is a browser addon compatibility problem rather than a Koha bug.
Comment 3 Nicole C. Engard 2014-03-14 20:24:10 UTC
Any idea what plugin this could be? Other links with a target of _blank work on other sites for me and on other pages in Koha. For example on the staged marc management tool the link to biblionumber works there for me, but not the opac link.  I am using Firefox on Mac.

Nicole
Comment 4 Katrin Fischer 2014-11-10 07:19:53 UTC
I have the same problem, haven't been able to tell which plugin it is yet.
Comment 5 Marc Véron 2014-11-17 21:43:06 UTC
I could reproduce the issue in the following case (FF and IE tested):

1. Close all Browser windows.
2. First open OPAC
3. Then open Staff client in the same window (or tab)
4. Go to a biblio's detail page 
5. Hit Link OPAC view: Open in new window.  
(Note: Make sure that OPACBaseURL is set, otherwise link will not display...)

Result: OPAC opens in same window (because it was already opened in this window before)

If I open first staff client and then hit the link, OPAC opens in a new window or tab as expected.
Comment 6 David Roberts 2014-11-25 23:49:55 UTC
I have a brand new Chrome install with no addons installed and I can reproduce this problem. I'm inclined to think that this is not related to a browser addon. I also couldn't get it to work using the steps listed in comment 5 - each time it opens in the same window/tab. This is tested with Chrome and IE.
Comment 7 Marc Véron 2014-11-26 07:23:02 UTC
I can no longer reproduce the issue on current master (FF, IE and Chrome).

Koha version: 	3.17.00.060
Comment 8 Tim Hannah 2014-12-16 23:10:12 UTC
Can reproduce in 3.16 and 3.18 in chrome and ie9 where staff detail page includes browse controls  / url includes a searchid parameter.

OPAC opens in new window, as expected, if staff side search finds and displays a single biblio (no browse controls, no searchid parameter).
Comment 9 Elaine Bradtke 2015-01-12 16:49:36 UTC
Can confirm in 3.18.02 - Debian - using Chrome.
In a single record, clicking on "Open in new window" does not open a new window, but navigates to the OPAC in the current window. However, it does work as expected in Firefox.
Comment 10 Abby 2015-01-13 03:03:20 UTC
Can't recreate bug in Firefox 34.0 or Chromium 39.0.2171.65 Ubuntu 14.04 (64-bit)
Comment 11 Liz Rea 2015-01-13 03:42:55 UTC
I was able to reproduce this using Tim's plan. It seems to be to do with the number of results you get back, and whether or not there is search navigation. Maybe we can talk more about it tomorrow. :)
Comment 12 Christopher Brannon 2015-02-03 19:00:32 UTC
Koha 3.16.4 with Firefox Nightly 31.0, all add-ons (Firebug) disabled, still doesn't open in new window.  Same for IE11.

I don't think it has to do with number of results, as it isn't from a results page.  It is from the record page (detail.pl).  And I don't think it is the number of items in the record, because it is doing it with a record that only has 3 items.

I can't reproduce Marc's findings.

Tim has the most plausible scenario.  I did a search for an item and the URL included a URL searchid parameter.  When I click on the Open in new window link, it opens the OPAC in the current tab.  When I back up, delete the searchid parameter and hit enter, same record opens without the Return to results control, and when I click on the link, it opens the OPAC in a new tab.  When I put the searchid back, the problem comes back.  I think Tim found the culprit.

Christopher
Comment 13 Nick Clemens 2015-02-03 19:39:06 UTC
Just adding bug 11890 as a possible related issue.  Seeing the same searchid appended to the link.  VOKAL has both issues on our system.  Disabling javascript clears the issue in both cases
Comment 14 Liz Rea 2015-02-03 21:18:36 UTC
The number of search results only matters because, if you search and get only one result, you won't have the search navigation.Clicking the link will work. If you, say, click the 3rd record in a list of several results, you will then have the search navigation (upper left hand side), and the link will open in the current window.

:)
Comment 15 Christopher Brannon 2015-02-03 21:20:06 UTC
(In reply to Liz Rea from comment #14)
> The number of search results only matters because, if you search and get
> only one result, you won't have the search navigation.Clicking the link will
> work. If you, say, click the 3rd record in a list of several results, you
> will then have the search navigation (upper left hand side), and the link
> will open in the current window.
> 
> :)

Yes, I agree.  :)

Christopher
Comment 16 Liz Rea 2015-02-03 21:23:32 UTC
Hooray! We understand each other! o/*HIGHFIVE*\o
Comment 17 Marcel de Rooy 2015-05-22 11:15:40 UTC
*** Bug 14243 has been marked as a duplicate of this bug. ***
Comment 18 Marcel de Rooy 2015-05-22 11:19:03 UTC
(In reply to Christopher Brannon from comment #12)

> Tim has the most plausible scenario.  I did a search for an item and the URL
> included a URL searchid parameter.  When I click on the Open in new window
> link, it opens the OPAC in the current tab.  When I back up, delete the
> searchid parameter and hit enter, same record opens without the Return to
> results control, and when I click on the link, it opens the OPAC in a new
> tab.  When I put the searchid back, the problem comes back.  I think Tim
> found the culprit.

Same for me in FF 38. Removing searchid parameter in URL made the difference.
Comment 19 Katrin Fischer 2015-08-11 11:22:28 UTC
Still an issue - could we modify the script that adds the searchid to the URLs to not touch the OPAC link?
Comment 20 Juan Romay Sieira 2016-02-09 16:46:05 UTC Comment hidden (obsolete)
Comment 21 Marc Véron 2016-02-10 10:27:42 UTC Comment hidden (obsolete)
Comment 22 Marcel de Rooy 2016-02-12 08:05:45 UTC
Created attachment 47953 [details] [review]
Bug 11937 - opac link doesn't open in new window

Signed-off-by: Juan Romay Sieira <juan.sieira@xercode.es>

Patch works as expected. From a biblio detail page, the link
'OPAC view: Open in new window' opens a new browser window.
Signed-off-by: Marc Veron <veron@veron.ch>

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Comment 23 Brendan Gallagher 2016-02-24 03:02:58 UTC
Pushed to Master - Should be in the May 2016 release.  Thanks
Comment 24 Julian Maurice 2016-02-26 15:11:25 UTC
Patch pushed to 3.22.x, will be in 3.22.4