From c5cbbf240ac1525bba27c14df75b9b2199fca317 Mon Sep 17 00:00:00 2001 From: Ralf Becker Date: Tue, 27 Jan 2015 15:14:56 +0000 Subject: [PATCH] fix autocomplete for Firefox by doing a real submit to an https url, as faked submit to "about:blank" causes a security warning in FF --- etemplate/empty.html | 0 etemplate/js/etemplate2.js | 16 +++++++++------- 2 files changed, 9 insertions(+), 7 deletions(-) create mode 100644 etemplate/empty.html diff --git a/etemplate/empty.html b/etemplate/empty.html new file mode 100644 index 0000000000..e69de29bb2 diff --git a/etemplate/js/etemplate2.js b/etemplate/js/etemplate2.js index d3bc0e5116..7eb8e8e24b 100644 --- a/etemplate/js/etemplate2.js +++ b/etemplate/js/etemplate2.js @@ -594,6 +594,10 @@ etemplate2.prototype.autocomplete_fixer = function (_node,_id) var $form = jQuery(document.createElement('form')) .attr({id:id + '_form_autocomplete_fixer',action:'about:blank', target:'egw_iframe_autocomplete helper'}) .css({height:"100%"}); + // Firefox give a security warning when transmitting to "about:blank" from a https site + // we work around that by giving existing etemplate/empty.html url + if (navigator.userAgent.match(/firefox/i)) + $form.attr({action: egw.webserverUrl+'/etemplate/empty.html',method:'post'}); //Creates iframe for fake submission $et2_container.before(jQuery(document.createElement('iframe')) .attr({id:id + '_iframe_autocomplete_fixer',src:'about:blank',name:'egw_iframe_autocomplete helper'}).hide()); @@ -604,13 +608,11 @@ etemplate2.prototype.autocomplete_fixer = function (_node,_id) setTimeout(function(){ var $a = jQuery(node).parent(); if ($a.length>0 && typeof $a.parent() != 'undefined') $a.submit(); //Submit to iframe - setTimeout(function(){ - //Clean up the mess from DOM - if(jQuery(node).parent().is('form')) - jQuery(node).unwrap(); - jQuery('iframe#'+id + '_iframe_autocomplete_fixer').remove(); - },1); - },1); + //Clean up the mess from DOM + if(jQuery(node).parent().is('form')) + jQuery(node).unwrap(); + jQuery('iframe#'+id + '_iframe_autocomplete_fixer').remove(); + },0); }; /**