Third-party JavaScript is external code loaded into a web page from another domain or service provider. It is often used for analytics, chat widgets, payment buttons, fraud detection, and other features that site owners do not want to build themselves. Because the browser executes this code with access to the page, it becomes part of the site’s trust boundary.
In cyber security, this matters most on sensitive pages such as checkout forms. If a third-party script is tampered with, injected, or overly privileged, it can read keystrokes, modify payment fields, or send card data to an attacker before the customer submits the form. Defenders reduce this risk by minimizing scripts, inventorying every dependency, using Subresource Integrity where possible, isolating payment components, and preferring hosted checkout flows when the business model allows it.


