If your website takes a long time to load when users visit it, this article may bring some inspiration to your optimization work. But even if it doesn't help you solve your problem, you can learn what are some common errors that affect website loading time.
Why is the page load time important?
The loading time of the page directly affects the user's intuitive experience of the website performance. Some research data shows that once the page loading time exceeds 3 seconds, half of the visiting users will be lost while waiting.
- Search Engine Ranking
- — Page load time is one of the important basis for search engines to rank your website in search results. Therefore, the load time of a web page affects how easy it is for users to find it on the web. Conversion Rate
- — The faster the page loads, the more engaged the user will be. A slow website will obviously lead to lower conversion rates. If your webpage takes too long to load, executing the Call-To-Action (CTA) will consume a lot of time. During this period, the user's patience and enthusiasm will be worn away, and they will eventually close your website without purchasing your product or Use the services you provide. User Experience — The longer your website takes to load, the more satisfied your users will be. As a result, customer retention and repeat visit rates will be higher.
- Let’s look at a few examples based on research done by HubSpot:
- A page that is 1 second slower could cost Amazon $1.6 billion in lost sales each year.
- A 2-second delay in Bing searches will result in a 4.3% revenue loss per visitor, a 3.75% decrease in clicks, and a 1.8% decrease in query volume.
- Based on the data above, you can see how important page load time is to your website.
There are many factors that affect page loading time. Among these errors, I have listed the errors I encountered when building a website. Here are five representative mistakes.
1. A large number of HTTP requestsEvery time the browser needs to get a file, page or image from the web server, it will make an HTTP request, after which you can Use the "Network" tab in Chrome's "Developer Tools" to monitor which network requests the application makes, which requests are time-consuming, and other information.
General browsers usually limit the number of HTTP requests issued at the same time to between 4-8. Therefore, when the number of concurrent requests is large, long waiting delays will occur. Research done by Yahoo shows that 80% of your application load time relies on HTTP requests, and reducing the total number of HTTP requests is helpful to speed up page load times.
You can reduce the total number of HTTP requests of the web application in the following ways:
- Merging CSS/JS files
- — You can try to merge the CSS files with JS files are merged into the same file, which reduces requests and eliminates the need to retrieve multiple files from the server. Since all CSS files are rendered in chunks, reducing CSS files will greatly improve page load times. Content loading on demand
- — Instead of loading all of your application’s images at once, load them only when needed. This approach is called lazy loading or on-demand loading. When a user arrives on your site, you can load images only when the user scrolls to that specific location, rather than loading them all on click. Enable Browser Cache
- — Allows caching of static images or website content that does not change frequently. When the user visits the website for the second time, the cache can load this content without sending a new HTTP request to the server. This makes content load faster. The server supports HTTP/2
- - Using HTTP/2, only one connection needs to be established from the browser to the server to load a website, and multiple requests are allowed at the same time. This is much more efficient than creating a new connection for each resource.
If your website does not have a CDN enabled, load times will increase when users are physically located far away from the server. These delays become more noticeable with distance and affect all HTTP requests to the server. Using a CDN can improve page load times.
CDNWhat is it? The full name of CDN is Content Delivery Network, which is content distribution network. CDN is a content distribution network built on the Internet. It relies on edge servers deployed in various places and uses the load balancing, content distribution, scheduling and other functional modules of the central platform to enable users to obtain the content they need nearby.
Using a CDN will enable users to obtain the resources required for a web page from the server closest to their location. Servers in a CDN are distributed in different geographical locations. So using this kind of CDN is one of the effective ways to improve application loading time.
For example, if your web server is located in California, your guest access network topology diagram might look like the following if you deploy a CDN.
Most CDN services have their own network backbone, which allows them to provide higher service quality, lower packet rates and faster traffic than the Internet. Loading speed etc. a bit. The disadvantage is that it is expensive.
3. File size and page size
Loading large size files from the web server or loading large page sizes will take a lot of time, so it may be in order Fetching several such large files makes page load times longer.
#Enabling compression is a common way to reduce the file size of HTTP requests and improve page load times.
There are two common compression methods:
The first method is Gzip. Gzip can locate similar codes in the file and temporarily replace them to make the file smaller. Currently, most web servers support Gzip compression. Enabling compression on HTML or CSS files can typically save about 50% or 70% on file size, thereby reducing page load times and bandwidth used. You can further reduce page load times by reducing the size of images used in your application.
Another compression solution is called Brotli. According to the official introduction, the compression is 20%~30% higher than gzip, and the execution efficiency is more efficient. I haven’t tested it specifically, so I can’t prove it. You can follow Consider your actual situation.
4. Load all resources at the same time
Loading all HTML, CSS and JS files at the same time will increase the page load time because the page is rendered before all these resources are loaded. The process will be blocked.
Delayed JavaScript loading is a mechanism for loading large JS files after other elements have been loaded. This method ensures that loading of page content is not affected by loading large JS files.
If you have an HTML site, you need to call the external JS file (defer.js) before the
The above is the detailed content of 5 common mistakes that affect page load times. For more information, please follow other related articles on the PHP Chinese website!

Different JavaScript engines have different effects when parsing and executing JavaScript code, because the implementation principles and optimization strategies of each engine differ. 1. Lexical analysis: convert source code into lexical unit. 2. Grammar analysis: Generate an abstract syntax tree. 3. Optimization and compilation: Generate machine code through the JIT compiler. 4. Execute: Run the machine code. V8 engine optimizes through instant compilation and hidden class, SpiderMonkey uses a type inference system, resulting in different performance performance on the same code.

JavaScript's applications in the real world include server-side programming, mobile application development and Internet of Things control: 1. Server-side programming is realized through Node.js, suitable for high concurrent request processing. 2. Mobile application development is carried out through ReactNative and supports cross-platform deployment. 3. Used for IoT device control through Johnny-Five library, suitable for hardware interaction.

I built a functional multi-tenant SaaS application (an EdTech app) with your everyday tech tool and you can do the same. First, what’s a multi-tenant SaaS application? Multi-tenant SaaS applications let you serve multiple customers from a sing

This article demonstrates frontend integration with a backend secured by Permit, building a functional EdTech SaaS application using Next.js. The frontend fetches user permissions to control UI visibility and ensures API requests adhere to role-base

JavaScript is the core language of modern web development and is widely used for its diversity and flexibility. 1) Front-end development: build dynamic web pages and single-page applications through DOM operations and modern frameworks (such as React, Vue.js, Angular). 2) Server-side development: Node.js uses a non-blocking I/O model to handle high concurrency and real-time applications. 3) Mobile and desktop application development: cross-platform development is realized through ReactNative and Electron to improve development efficiency.

The latest trends in JavaScript include the rise of TypeScript, the popularity of modern frameworks and libraries, and the application of WebAssembly. Future prospects cover more powerful type systems, the development of server-side JavaScript, the expansion of artificial intelligence and machine learning, and the potential of IoT and edge computing.

JavaScript is the cornerstone of modern web development, and its main functions include event-driven programming, dynamic content generation and asynchronous programming. 1) Event-driven programming allows web pages to change dynamically according to user operations. 2) Dynamic content generation allows page content to be adjusted according to conditions. 3) Asynchronous programming ensures that the user interface is not blocked. JavaScript is widely used in web interaction, single-page application and server-side development, greatly improving the flexibility of user experience and cross-platform development.

Python is more suitable for data science and machine learning, while JavaScript is more suitable for front-end and full-stack development. 1. Python is known for its concise syntax and rich library ecosystem, and is suitable for data analysis and web development. 2. JavaScript is the core of front-end development. Node.js supports server-side programming and is suitable for full-stack development.


Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

AI Hentai Generator
Generate AI Hentai for free.

Hot Article

Hot Tools

DVWA
Damn Vulnerable Web App (DVWA) is a PHP/MySQL web application that is very vulnerable. Its main goals are to be an aid for security professionals to test their skills and tools in a legal environment, to help web developers better understand the process of securing web applications, and to help teachers/students teach/learn in a classroom environment Web application security. The goal of DVWA is to practice some of the most common web vulnerabilities through a simple and straightforward interface, with varying degrees of difficulty. Please note that this software

VSCode Windows 64-bit Download
A free and powerful IDE editor launched by Microsoft

MinGW - Minimalist GNU for Windows
This project is in the process of being migrated to osdn.net/projects/mingw, you can continue to follow us there. MinGW: A native Windows port of the GNU Compiler Collection (GCC), freely distributable import libraries and header files for building native Windows applications; includes extensions to the MSVC runtime to support C99 functionality. All MinGW software can run on 64-bit Windows platforms.

ZendStudio 13.5.1 Mac
Powerful PHP integrated development environment

WebStorm Mac version
Useful JavaScript development tools