Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Why does Google use inline JavaScript and CSS? [closed]

Tags:

javascript

css

I can only see inline CSS and JS while viewing the source code of Google webpage. I don't see any CSS file or JS file being included.

How do they include jquery, plugins etc? (or) Does Google use Jquery?

like image 244
M Ram Kumar Avatar asked Mar 24 '12 11:03

M Ram Kumar


People also ask

What is inline JavaScript and CSS?

What is inline CSS and JavaScript? # Inlining CSS and JavaScript both refer to simply including the CSS and JS within your HTML file. Inline small CSS should be included within the <head> tags of an HTML file while inline small JavaScript can be included either within the <head> tag or the <body> tag.

Is inline CSS OK?

You can use inline CSS but it is not advisable to use inline CSS because: If we use inline CSS then we have to repeat inline CSS to every element to every pages where that element is used but if we use ID selector then by writing only one CSS we can apply to every element on every page.

Should you inline JS?

Note: Using Inline JavaScript is a bad practice and it is not recommended. It can be used for demonstration purposes so that the demonstrator doesn't have to deal with 2 separate files at a time. It is recommended to write JavaScript code in a separate .

What is inline JavaScript?

Description. The "Inline JavaScript" filter reduces the number of requests made by a web page by inserting the contents of small external JavaScript resources directly into the HTML document. This can reduce the time it takes to display content to the user, especially in older browsers.


1 Answers

Google uses Closure Compiler to compress its JavaScript.
No, Google certainly does not use jQuery—it is all vanilla JavaScript and (sometimes) Closure Library.

As for inlining, if JS/CSS is relatively small, it is faster to inline it to minimize the number of HTTP requests.

Google Page Speed Online can give you some tips on how to optimize your page.
mod_pagespeed for Apache can do many optimizations for you (including content inlining where appropriate).

like image 155
Dan Abramov Avatar answered Sep 18 '22 08:09

Dan Abramov