---
title: Optimize Javascript
description: "**Impact area** Manageability **Severity** Medium ## Impact The  `` tag places JavaScript right before the closing`  `element, causing the browser to attempt to load the JavaScript before rendering any other content on the page. This may have unintended consequences and/or cause slower page…"
url: "https://community-staging.qualityclouds.com/qcdocs/qc/salesforce-rules/optimize-javascript/"
updated: "2025-03-21"
category: Rules
---

# Optimize Javascript

**Impact area**

Manageability

**Severity**

Medium

## Impact

The  `<apex:includeScript>` tag places JavaScript right before the closing` </head> `element, causing the browser to attempt to load the JavaScript before rendering any other content on the page. This may have unintended consequences and/or cause slower page loads.

## Remediation

Use the standard HTML `<script>` tag instead of `<apex:includeScript>`.

## References

See the Salesforce documentation article: [Optimizing JavaScript](https://developer.salesforce.com/docs/atlas.en-us.salesforce_visualforce_best_practices.meta/salesforce_visualforce_best_practices/pages_best_practices_perf_webdev_javascript.htm).
