shawncun Posted January 10, 2025 Posted January 10, 2025 Is it possible to add a CORS header to allow me to use a hosted JS file for a Chrome extension?
wolstech Posted January 11, 2025 Posted January 11, 2025 Not sure if this is possible for a plain js file. Krydos would know more. I know for PHP, people have done it with header(), so I guess worst case you could make a PHP file that sends your headers (content-type is the minimum, and in your case obviously the CORS headers), then just call readfile() to spit out the js.
Krydos Posted January 11, 2025 Posted January 11, 2025 You can set CORS headers with .htaccess Header set Access-Control-Allow-Origin "https://example.com"
Recommended Posts