图像预加载会干扰Ajax请求

时间:2021-10-19 20:17:11

I preload a large number of images on a page. However, this approach queues all Ajax requests at the end, making the interface unresponsive until all images are loaded. What would be your favorite approach to bump the priority on the Ajax requests?

我在页面上预加载了大量图像。但是,此方法最后将所有Ajax请求排入队列,使得接口无响应,直到加载所有映像。什么是你最喜欢的方法来提高Ajax请求的优先级?

2 个解决方案

#1


1  

I'd make a subdomain for either the image requests or the AJAX requests. That way, you can sidestep the browser limit on same domain requests.

我会为图像请求或AJAX请求创建一个子域。这样,您可以回避相同域请求的浏览器限制。

#2


0  

No ajax call should make the interface unresponsive. Google Instant sends ajax requests one after the other, without your Firefox/Chrome becoming unresponsive. Ajax nature is asynchronous. Can you provide more details please? Also I recommend predictive fetch pattern.

没有ajax调用应该使接口无响应。 Google Instant会一个接一个地发送ajax请求,而不会让您的Firefox / Chrome无响应。 Ajax本质是异步的。你能提供更多细节吗?我也推荐预测获取模式。

#1


1  

I'd make a subdomain for either the image requests or the AJAX requests. That way, you can sidestep the browser limit on same domain requests.

我会为图像请求或AJAX请求创建一个子域。这样,您可以回避相同域请求的浏览器限制。

#2


0  

No ajax call should make the interface unresponsive. Google Instant sends ajax requests one after the other, without your Firefox/Chrome becoming unresponsive. Ajax nature is asynchronous. Can you provide more details please? Also I recommend predictive fetch pattern.

没有ajax调用应该使接口无响应。 Google Instant会一个接一个地发送ajax请求,而不会让您的Firefox / Chrome无响应。 Ajax本质是异步的。你能提供更多细节吗?我也推荐预测获取模式。