![]() The HTTP/2 protocol, which was launched in 2015, resolved this problem by allowing parallel downloads. This meant that one file had to be downloaded completely before the next file could start downloading. In HTTP/1.0 and HTTP/1.1, each Javascript and CSS file had to be downloaded in sequential order. Will My WordPress Site Be Faster if I Combine External Javascript Files?ĭue to improvements in the Hypertext Transfer Protocol, it is no longer essential to combine Javascript files and CSS files unless your web hosting company does not have support for HTTP/2. ![]() External CSS files can also be combined, reducing the number of HTTP requests of a page even further. If a web page requires nine Javascript files to display correctly, combining external JS files in WordPress could help you reduce the total number of HTTP requests for Javascript code from nine to only two. Important Javascript functions should be made a priority. The second Javascript file contains less important functions that can be called once the page has been loaded. Less Important Javascript Functions (File 2) The first Javascript file contains important functions which are required to render the initial page load correctly. Some search engines recommend combining external Javascript into two files. So by combining external Javascript files in WordPress, you can greatly reduce the number of HTTP requests that are made during page rendering. When files are downloaded in sequential order, a high number of HTTP requests can increase the time it takes to load a web page. ![]() The browser, therefore, has to make an HTTP request for each Javascript file that is required for the page. This is known as page rendering.Ī request to access a file on a server is called an HTTP request. When someone views a web page, the browser builds the page by processing each line of code in order. It is more practical to do this as it separates the code and allows Javascript functions to be called by many pages.Įach Javascript file that is required by a web page has to be downloaded by the browser during the page rendering process. Whilst Javascript functions can be added directly into HTML using the SCRIPT tag, it is common practice to save Javascript code in an external file instead. Why Combine External Javascript Files in WordPress? I will also talk about why combining external Javascript files is no longer necessary for most website owners. In this article, I will explain why many website owners combine external Javascript in WordPress and share some useful WordPress plugins which can be used to perform this task. The technique is sometimes referred to as Javascript aggregation. A popular optimisation technique for tackling this problem is to combine multiple Javascript files in order to reduce the number of HTTP requests a browser has to make. In the first versions of the Hypertext Transfer Protocol, Javascript can slow down websites as each Javascript file had to be downloaded and executed in order for the page to be displayed correctly. Unfortunately, it can also make a website slow if it is not optimised correctly. ![]() I believe Javascript is essential to modern WordPress websites. For example, your theme’s home page slider may require a file called slider.js to function correctly, whereas your contact form page may require a file called form.js. js and on a typical WordPress website, Javascript files are inserted into pages by the WordPress theme and WordPress plugins that are activated. It is also used to display image galleries, interactive menus, countdown timers and more. On WordPress websites, for example, Javascript is used to embed audio and video. The javascript programming language helps web pages display dynamic content.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |