diff --git a/src/jquery.form.js b/src/jquery.form.js index af5c5082..072327a3 100644 --- a/src/jquery.form.js +++ b/src/jquery.form.js @@ -125,7 +125,7 @@ } /* eslint consistent-this: ["error", "$form"] */ - var method, action, url, $form = this; + var method, action, url, isMsie, iframeSrc, $form = this; if (typeof options === 'function') { options = {success: options}; @@ -154,12 +154,16 @@ // clean url (don't include hash vaue) url = (url.match(/^([^#]+)/) || [])[1]; } + // IE requires javascript:false in https, but this breaks chrome >83 and goes against spec. + // Instead of using javascript:false always, let's only apply it for IE. + isMsie = /(MSIE|Trident)/.test(navigator.userAgent || ''); + iframeSrc = (isMsie && /^https/i.test(window.location.href || '')) ? 'javascript:false' : 'about:blank'; // eslint-disable-line no-script-url options = $.extend(true, { url : url, success : $.ajaxSettings.success, type : method || $.ajaxSettings.type, - iframeSrc : /^https/i.test(window.location.href || '') ? 'javascript:false' : 'about:blank' // eslint-disable-line no-script-url + iframeSrc : iframeSrc }, options); // hook for manipulating the form data before it is extracted;