Author: jleroux Date: Sun Jan 18 11:12:11 2015 New Revision: 1652731 URL: http://svn.apache.org/r1652731 Log: A patch from Gareth Carter for "framework/images/webapp/images/fieldlookup.js throws a javascript error in google chrome from a link to ofbiz from another site" https://issues.apache.org/jira/browse/OFBIZ-5968
When you link to your ofbiz installation from another site using _blank as the target and protocol is changing from http to https, google chrome will throw an error - Blocked a frame with origin "https://ofbiz.company.com" from accessing a frame with origin "http://other.company.com". The frame requesting access has a protocol of "https", the frame being accessed has a protocol of "http". Protocols must match. This error may prevent other javascript from executing (this has caused, in our ofbiz installation, datetimepickers from working properly) jleroux: this simply adds a try/catch block and use the parent in case of failure Modified: ofbiz/trunk/framework/images/webapp/images/fieldlookup.js Modified: ofbiz/trunk/framework/images/webapp/images/fieldlookup.js URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/images/webapp/images/fieldlookup.js?rev=1652731&r1=1652730&r2=1652731&view=diff ============================================================================== --- ofbiz/trunk/framework/images/webapp/images/fieldlookup.js (original) +++ ofbiz/trunk/framework/images/webapp/images/fieldlookup.js Sun Jan 18 11:12:11 2015 @@ -684,11 +684,20 @@ function lookupPaginationAjaxRequest(nav ******************************************************************************/ var re_id = new RegExp('id=(\\d+)'); var num_id = (re_id.exec(String(window.location)) ? new Number(RegExp.$1) : 0); -var obj_caller = (window.opener && window.opener.lookups? window.opener.lookups[num_id]: null); -if (obj_caller == null && window.opener != null) { - obj_caller = window.opener; -} else if (obj_caller == null && window.opener == null) { +var obj_caller; +try { + obj_caller = (window.opener && window.opener.lookups? window.opener.lookups[num_id]: null); + if (obj_caller == null && window.opener != null) { + obj_caller = window.opener; + } else if (obj_caller == null && window.opener == null) { + obj_caller = parent; + } +} +catch (err) { obj_caller = parent; + if (console) { + console.log(err); + } } function setSourceColor(src) {

