Welcome to WebmasterWorld Guest from 3.93.75.30

Forum Moderators: open

Message Too Old, No Replies

jQuery-3.3.1.min.js and a message

     
8:46 pm on Sep 8, 2018 (gmt 0)

Senior Member

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month

joined:Oct 25, 2006
posts: 1105
votes: 1


I have all the message like: Synchronous XMLHttpRequest on the main thread is deprecated because of its detrimental effects to the end user's experience.
As I understand it is related to browser, not jQuery. Some remind were seen per internet: The API is guaranteeing that if you attempted to use the loaded HTML in the line of JavaScript after the .load() it would be available. If the request is changed to an async request, jQuery can no longer guarantee that the loaded HTML is available.

I'm using code inside Javascript:
myslider = {
init: function() {
var $ = jQuery;
$('.slide_show').mySlider(
{
mode: 'fade',
useCSS: false,
speed: 100
}
);
}
}

How to avoid this warning?
Is it enough to put all the time $.ajax in the start?
init: function() {
var $ = jQuery;
$.ajax('.slide_show').mySlider(
{
mode: 'fade',
useCSS: false,
speed: 100
}
);
}
}


[edited by: not2easy at 9:54 pm (utc) on Sep 8, 2018]
[edit reason] readability [/edit]

1:51 am on Sept 9, 2018 (gmt 0)

Senior Member

WebmasterWorld Senior Member Top Contributors Of The Month

joined:Apr 1, 2016
posts:2690
votes: 815


If the request is changed to an async request, jQuery can no longer guarantee that the loaded HTML is available.

You can use promises to ensure that any code requiring the loaded html will only be called once and if the html is actually loaded. I'm not sure if the jQuery promise is sufficient for this, but the plain JS promise API will ensure this. As such the rest of your page can load and render without blocking the thread while you wait for that request to load.
12:18 pm on Sept 14, 2018 (gmt 0)

Senior Member

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month

joined:Oct 25, 2006
posts: 1105
votes: 1


Why Google Chrome keeps this outdated warnings when using Console?
 

Join The Conversation

Moderators and Top Contributors

Hot Threads This Week

Featured Threads

Free SEO Tools

Hire Expert Members