From 70c8ee2a39aa535ed7ce565f136b931546a1cc20 Mon Sep 17 00:00:00 2001 From: Nick Clemens Date: Sat, 14 Jul 2018 14:29:53 +0000 Subject: [PATCH] Bug 21078: overdrive.js Catch error if window.opener is not accessible To Test: 0 - Enable overdrive search results on your koha 1 - From a source develop a link to your koha instance that opens a new window: Test 2 - Click that link 3 - Note Overdrive results do not load 4 - Note error in JS console 5 - Apply patch 6 - Click the link again 7 - Note OD results load 8 - Note no error in console Signed-off-by: Martin Renvoize Signed-off-by: Katrin Fischer --- koha-tmpl/opac-tmpl/bootstrap/js/overdrive.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/koha-tmpl/opac-tmpl/bootstrap/js/overdrive.js b/koha-tmpl/opac-tmpl/bootstrap/js/overdrive.js index 24717f5..5cf8170 100644 --- a/koha-tmpl/opac-tmpl/bootstrap/js/overdrive.js +++ b/koha-tmpl/opac-tmpl/bootstrap/js/overdrive.js @@ -86,7 +86,8 @@ KOHA.OverDriveCirculation = new function() { $( document ).ready(function() { var p = window.opener; if (p) { - cb = p.refresh_overdrive_account_details; + try { cb = p.refresh_overdrive_account_details;} + catch(err){ return; } //Catch error if opener is not accessible if (cb) { cb(); } else { -- 2.1.4