Post by taslima on Feb 14, 2024 14:31:47 GMT 8
The top of the page may enable content at the top of the page to become visible to users without having to wait for large JavaScript files to load. So, here’s how to externalize JavaScript: Identify the JavaScript code that you want to externalize by locating the opening and closing <script> tag with the HTML source code of the webpage. Cut the javascript code, which is between <script> and </script>. Using a text editor like Notepad, create a new document and paste the JS code into the new blank document. Save the file with the file extension “.js”.
Upload the file to your server and make a note of its path. Go back to your original html file and insert the following, where “path/filesource.js” is the URL of the newly created .js file: <script language=”Java Ivory Coast Email List Script” src=”path/filesource.js”></script> Now, the embedded JavaScript code is replaced with just one line. When search engines crawl the webpage, they will only have one line of code to read before they go on to the rest of the page. Subsequently, this can help with Google’s page experience algorithm update, specifically, First Input Delay. (Note that FID will be replaced by Interaction to Next Paint (INP) in March 2024.) How to Externalize CSS.
To externalize style sheets, simply follow the same instructions as for the JavaScript file, except save the file with a .css file extension. In the original webpage code you’ll replace all the CSS coding with the following: <link href=”cssfilename” rel=”stylesheet” type=”text/css”> Once again you are left with one line of code on your original page, allowing for simpler site indexing for the spiders. Small Steps, Big Impact Externalizing JavaScript and CSS won’t fix your website performance problems, but it’s a great start. One client we worked with implemented these two best practices and reduced 20,000 lines of code to 1,500. The website subsequently saw a significant improvement in rankings and moved to the top of organic search results for many keywords. So, yes, it is effective and a good place to start as you are improving the performance of your web pages. Need help boosting your website’s speed and search ranking?
Upload the file to your server and make a note of its path. Go back to your original html file and insert the following, where “path/filesource.js” is the URL of the newly created .js file: <script language=”Java Ivory Coast Email List Script” src=”path/filesource.js”></script> Now, the embedded JavaScript code is replaced with just one line. When search engines crawl the webpage, they will only have one line of code to read before they go on to the rest of the page. Subsequently, this can help with Google’s page experience algorithm update, specifically, First Input Delay. (Note that FID will be replaced by Interaction to Next Paint (INP) in March 2024.) How to Externalize CSS.
To externalize style sheets, simply follow the same instructions as for the JavaScript file, except save the file with a .css file extension. In the original webpage code you’ll replace all the CSS coding with the following: <link href=”cssfilename” rel=”stylesheet” type=”text/css”> Once again you are left with one line of code on your original page, allowing for simpler site indexing for the spiders. Small Steps, Big Impact Externalizing JavaScript and CSS won’t fix your website performance problems, but it’s a great start. One client we worked with implemented these two best practices and reduced 20,000 lines of code to 1,500. The website subsequently saw a significant improvement in rankings and moved to the top of organic search results for many keywords. So, yes, it is effective and a good place to start as you are improving the performance of your web pages. Need help boosting your website’s speed and search ranking?