Skip to content

Update default iframeSrc to be 'about:blank' for browsers other than IE #572

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Jun 7, 2020
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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