Score: 4.1/5 (11 votes)
Why is it a bad practice to use inline script tags?
Inline styles, while they have a purpose, generally are not the best way to maintain your website. They go against every one of the best practices: Inline styles don't separate content from design: Inline styles are exactly the same as embedded font and other clunky design tags that modern developers rail against.
Chrome does try to cache inline scripts, by attaching their cache to the HTML document's resource, but these caches then become dependent on the entire HTML document not changing, and are not shared between pages.
An inline style may be used to apply a unique style for a single element. To use inline styles, add the style attribute to the relevant element. The style attribute can contain any CSS property.
An inline function is one for which the compiler copies the code from the function definition directly into the code of the calling function rather than creating a separate set of instructions in memory. This eliminates call-linkage overhead and can expose significant optimization opportunities.
An inline CSS is used to apply a unique style to a single HTML element. An inline CSS uses the style attribute of an HTML element.
Alternatively referred to as in-line, inline is any element contained within a program, document, or message. For example, with HTML, inline code is anything built into the web page, instead of being loaded from an external file.
Inline and External Scripts
The <script> tag allows code to either be embedded directly into HTML, or included from external script files. Inline scripts are created by placing code between <script> and </script> tags in an HTML file. ... The external files are referenced via a URL specified by the “src” attribute.
Why 'unsafe-inline' in script - src is bad
When properly configured, modern browsers will block any script or style that is not explicitly whitelisted. The use of 'unsafe-inline' basically allows unknown scripts and styles to be executed and thereby weakens the whole system.
Allow Inline Style Attribute using a hash
Either the 'unsafe-inline' keyword, a hash ('sha256-nMxMqdZhkHxz5vAuW/PAoLvECzzsmeAxD/BNwG15HuA='), or a nonce ('nonce-...') is required to enable inline execution.
The answer to both your questions is no. Unless the whole page is being cached. A browser can't cache part of a file, since it would have to download it to know which parts it had cached and by that time it's downloaded them all anyways.
- Hit CTRL-F5 or CTRL-SHIFT-R in most modern browsers to force reload.
- Use the developer's console to clear the cache.