Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Multiple external JavaScript files using one script tag

I have seen on some websites they have one script tag but call multiple JS file e.g. <script src="script1.js,script2.js,script3.js"></script>

How do I do this? (Looking for both PHP and ASP.NET)

I have done a search on Google but struggled to find anything relevant.

Thanks

like image 828
Cameron Avatar asked Jan 19 '23 14:01

Cameron


1 Answers

You need to write a server-side script that parses the script names from the URL or query string, and sends a single response with the contents of all of the scripts.

Make sure to validate the script names to prevent attackers from reading arbitrary files.

like image 66
SLaks Avatar answered Jan 31 '23 08:01

SLaks