Skip to content

Latest Chrome update breaks plugin response handling #571

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

Closed
webmasterlv opened this issue May 20, 2020 · 17 comments
Closed

Latest Chrome update breaks plugin response handling #571

webmasterlv opened this issue May 20, 2020 · 17 comments

Comments

@webmasterlv
Copy link

Description:

After the latest Chrome update (mine is 83.0.4103.61) the success callback is not called anymore if using iframe:true although the request gets to the server. Chrome dev tools shows request as cancelled.
I managed to fix this by setting iframeSrc:'about:blank'.
I cannot find a reason or implication of this change. But maybe iframeSrc default should be changed?

Expected Behavior:

Receive success callback with response from server.

Actual behavior:

Success callback is not called, request shows aborted in Chrome.

Versions:

LoadJSON:
jQuery: 3.4
Browsers: Chrome 83.0.4103.61

Demonstration

Demo here

Steps to reproduce:

Use default setting of iframeSrc

@webmasterlv webmasterlv changed the title Latest Chrome update breaks plugin complete Latest Chrome update breaks plugin response handling May 20, 2020
@phpandrew
Copy link

phpandrew commented May 20, 2020

I am also having the same problem.

To elaborate on @webmasterlv post:
Change:
options = $.extend(true, { url: url, success: $.ajaxSettings.success, type: method || 'GET', iframeSrc: /^https/i.test(window.location.href || '') ? 'javascript:false' : 'about:blank' }, options);

to
options = $.extend(true, { url: url, success: $.ajaxSettings.success, type: method || 'GET', iframeSrc: 'about:blank' }, options);

@webmasterlv
Copy link
Author

webmasterlv commented May 20, 2020

I Googled a little bit about this, and seems like about:blank is the best to be used.
HTML standard says:

If the element has no src attribute specified, or its value is the empty string, let url be the URL "about:blank".

There are major updates at the moment, and apparently Chrome does not like javascript:false anymore in the iframe source.

@longwave
Copy link

Originally this always used about:blank but javascript:false was added for https URLs in ce43241 - but unfortunately the commit doesn't explain why.

@klonos
Copy link

klonos commented May 25, 2020

I'm on 83.0.4103.61 on latest MacOS Catalina and cannot reproduce this. I've used the jsfiddle and both buttons work for me.

@wordish
Copy link

wordish commented May 25, 2020

@klonos both buttons will trigger an alert, but the difference lies in the actual network response. For me, prior to 83, both buttons result in a 404 response from jshell.net. But for 83, the default iframeSrc button request is canceled by the browser, whereas the about:blank version sends the request and receives a 404 response.

default

Screenshot from 2020-05-25 15-47-20

about:blank

Screenshot from 2020-05-25 15-47-34

@arcataroger
Copy link

arcataroger commented May 26, 2020

(Edit: Oh, nevermind, just saw #572, which patches this and already accounts for IE)

Just wanted to chime in and say that over in Drupal land, the about:blank fix has worked for many of us. We are also unclear about why it was changed to javascript:false for https sites, but the workaround seems to pass our tests.

Quick note is that about:blank might break this for IE11 in unclear ways. The Drupal patch added a user agent check to bypass IE.

@devna13
Copy link

devna13 commented May 27, 2020

same problem here

using jquery 1.5 and jquery form for document upload
after chrome 83 upgrade
asp .net forms authentication needs

<authentication mode="Forms">
            <forms requireSSL="true" cookieSameSite="None" .....

and document upload needed to be updated to :

$("#ajaxUploadForm").ajaxForm({
iframe: true,
dataType: "json",
iframeSrc: "about:blank",
javascript: false,

.....

not the best fix but works for now...

@josepharhar
Copy link

I was linked to this issue from https://bugs.chromium.org/p/chromium/issues/detail?id=1086008
As others have pointed out, the issue is with using javascript: urls, and using about:blank instead is the workaround.
I have a fix in chrome on the way, and it will likely be available in chrome 84.

@krishnan-unni
Copy link

@josepharhar is this issue same as #573 ?

@josepharhar
Copy link

@josepharhar is this issue same as #573 ?

Since that issue says that you must have an iframe with src=“javascript:false”, i think it is the same issue.

@krishnan-unni
Copy link

krishnan-unni commented May 28, 2020

@josepharhar Yes we have a iframe created by jquery.form plugin with src as javascript:false. I just can confirmed by modifying the plugin to change the javascript:false to about:blank and it worked.

@AnanthaRakshith
Copy link

@josepharhar Please suggest me that I need to do upgrade the jquery plugin with the new version or the chrome developers will going to fix in the next release, if yes please suggest me how I need to handle this case for the time being.

whatisjasongoldstein pushed a commit to theatlantic/django-cropduster that referenced this issue May 29, 2020
Patches jquery.form per advice on this issue:

jquery-form/form#571

Ajax doesn't support posting files, so before FormData, the only
way to upload a file without a page refresh was to create an iframe,
build a form in it, and submit that to the server in a way where it
could sync up with the data POSTed by ajax.

Chrome 83 has an issue with the fake src jquery.form was setting
on that iframe, and would cancel the request. With no image
uploaded to the server (but no error in js to treat as a blocking
error) the process would attempt to continue and hit an error
when it tries to access a file that doesn't exist.

FUN-2604
@josepharhar
Copy link

It will be fixed in chrome within the next three weeks

whatisjasongoldstein pushed a commit to theatlantic/django-cropduster that referenced this issue May 29, 2020
Patches jquery.form per advice on this issue:

jquery-form/form#571

Ajax doesn't support posting files, so before FormData, the only
way to upload a file without a page refresh was to create an iframe,
build a form in it, and submit that to the server in a way where it
could sync up with the data POSTed by ajax.

Chrome 83 has an issue with the fake src jquery.form was setting
on that iframe, and would cancel the request. With no image
uploaded to the server (but no error in js to treat as a blocking
error) the process would attempt to continue and hit an error
when it tries to access a file that doesn't exist.

FUN-2604
@AnanthaRakshith
Copy link

@josepharhar Thank you so much for your update.

@josepharhar
Copy link

Yep, I got an update to 83.0.4103.97 on my personal machine today which includes the fix, it is getting rolled out earlier than I originally planned. Check chrome://settings/help to see if you have the update!

@FortyNinjaFISH
Copy link

Latest Google Chrome update (v83.0.4103.97) appears to have solved this issue for me.

i removed my previous post as i thought i was on the wrong thread - whoops!

@kevindb
Copy link
Contributor

kevindb commented Jun 7, 2020

Fixed by #572

@kevindb kevindb closed this as completed Jun 7, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests