Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Duplicate requests after chrome update to Version 75.0.3770.80 (Official Build) (64-bit) and save data twice into database issue

I am facing a strange issue after google chrome update to Version 75.0.3770.80 (Official Build) (64-bit) yesterday.

I am using Laravel and if I am trying to create a task using Ajax then it's adding twice from Google Chrome only but If I am creating the same task in firefox or in another browser then its working fine with a single entry. This issue I am facing only after chrome update otherwise it was working fine before. Is there any change in this new version which can affect my functionality?

I tried to analyze the issue and I have found the following difference which is given in below images for chrome and firefox. globalTask request showing one canceled request in chrome but I think it's executing correctly at server side and add an entry in a database. Can anyone help me to fix the issue?

Chrome enter image description here

Firefox enter image description here

Codes

$.ajax({
    url: "/globalTask",
    type: "POST",
    headers: {
        'X-CSRF-Token': 'hgdhgsddshjfs214dsf4s56f',
    },
    async: false,
    data: data,
    success: function (response) {

    }
});
like image 829
Rakesh Sojitra Avatar asked Jun 07 '19 05:06

Rakesh Sojitra


People also ask

Is the chrome 32 bit package approved as a trusted package?

This package was approved as a trusted package on 04 Jun 2019. Chrome is a fast, simple, and secure web browser, built for the modern web. This package uses Chrome's administrative MSI installer and installs the 32-bit on 32-bit OSes and the 64-bit version on 64-bit OSes.

Why does Google Chrome send multiple requests to fetch a page?

Google chrome sends multiple requests to fetch a page, and that's -apparently- not a bug, but a feature. And we as developers just have to deal with it. As far as I could dig out in five minutes, chrome does that just to make the surfing faster, so if one connection gets lost, the second will take over.

What is the latest Chrome version 76 bug in CRM?

This bug occurred in EMEA. The version 76 of Chrome is scheduled for July 30th, which will help this bug, but the official has not yet confirmed about the date. Issue using CRM 365 with latest Chrome version. A workaround could be to disable the Chrome flag #enable-lazy-frame-loading. The issue is that Chrome is lazy loading iframes.

What is second GET request in chrome?

Chrome sends the second get request for obtaining favorite icon which you see on top of every tab opened. It is NOT a second get to cater time out or any such thing.


3 Answers

I think I've found that this is related to preventDefault... looks to me like Chrome 75 is terminating a formPost if made via JS if you don't do a preventDefault() on the original event.

like image 156
user984976 Avatar answered Oct 22 '22 06:10

user984976


check, if the submit button has the type "submit" or "button". If your ajax is submitting the form, then the html button should have the type "button", otherwise both is submitted. I think that has solved the problem for me.

like image 25
kkovacs Avatar answered Oct 22 '22 07:10

kkovacs


I am also seeing this issue (two HTTP POSTs, one of which is 'canceled') in our site on any form submit. We're using ASP.NET MVC 5 with JQuery 1.11 and Bootstrap 3.0.3.

Updating JQuery to the latest version (3.4.1) resolved our issue. Looking at the Chrome Network trace in Chrome 74 the initiator would say 'Other', but then in Chrome 75 one of the requests will show 'Other' and the second will have a JScript trace that went to JQuery's trigger function.

Initially added this code snippet to our login page and it fixed the issue. The Network trace shows a single request, but it was the JQuery stack trace as the Initiator and not 'Other'. Not sure how this code "fixed" the problem, so I'd avoid it as a band-aid.

// Chrome 75 is having double submit problems. This change stops that behavior, but may be an issue in JQuery 1.x
$(document).on('submit', 'form', function () {
   var button = $(this).find('input[type="submit"]');
   button.attr('disabled', 'disabled');
});

Looks like Google may be investigating the issue: Chromium bug report

like image 29
Kyle Walker Avatar answered Oct 22 '22 08:10

Kyle Walker