JavaScript files are not subject to the same-origin policy, however. Webpages will frequently import JavaScript files from third-party sources like https://ajax.googleapis.com and the browser will happily execute them.
https://ajax.googleapis.com
cross-domain-loading.js
/** * Load in a JavaScript library from another origin. */ fetch('https://ajax.googleapis.com/ajax/libs/jquery/3.6.0/jquery.js') .then(response => { // This will succeed because browsers will allow // JavaScript to be loaded from other origins. })