What are static and dynamic resources in html page

A html page is consisted of some resources, such as js, css, image or other words etc. These sources are static or dynamic.

What are static and dynamic resources?

Static resources: files exits in web server, including archives (such as .zip and .jar files), images, style sheets, JavaScript, and other files.

Dynamic resouces: files created by web applications, such as content queried from database,image thumbnails created by parameters etc.

How to check a resource is static or dynamic?

If a file exists in your website server, it may be a static resource. We also can check a file is static or dynamic by its url, if its url contains “?”, the browser will recognize it a dynamic, even if the file exists in your web server.

For example: the url http://example.com/1ogo.png?v=1
Image logo.png exits in your hosts, however, the url contains query parameter “v”, the browse will recongnize logo.png is a dynamic resrouce.

How to process static and dynamic resources by browser?

The browsers will process static and dynamic resource differently, It may cache the static resource and decrease their laoding time. However, to dynamic resources, it will load them per request and do not cache them. so if you want to optimaze your site performace, you should use static resource other than dynamic one.