Include JavaScript Code From Static Resources

Impact Area

Manageability

Severity

Medium

Affected Element

Apex Page

Rule ID #

SF-0134

Impact #

Directly importing css and javascript files without using static resources increases load times.

Remediation #

Use static resources to serve JavaScript files, as well as images, CSS, and other non-changing files. JavaScript and other assets served this way benefit from the caching and content distribution network (CDN) built into Salesforce.

Time to fix #

30 min

References #

See the Salesforce documentation article: Visualforce Performance: Best Practices > Optimizing JavaScript.

Was it helpful ?

THE AI CODE GOVERNANCE BRIEF

Sign up for new updates!