Skip to content

Commit

Permalink
Merge pull request #572 from KorvinSzanto/patch-1
Browse files Browse the repository at this point in the history
Update default iframeSrc to be 'about:blank' for browsers other than IE
  • Loading branch information
kevindb authored Jun 7, 2020
2 parents 7a76ea3 + c8f9a22 commit b3c2209
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions src/jquery.form.js
Original file line number Diff line number Diff line change
Expand Up @@ -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};
Expand Down Expand Up @@ -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;
Expand Down

0 comments on commit b3c2209

Please sign in to comment.