问题描述
我看到的一些网站,他们有一个脚本标记,但如调用多个JS文件<脚本SRC =script1.js,script2.js,script3.js>< / SCRIPT>
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>
我如何做到这一点? (寻找PHP和ASP.NET)
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.
感谢
推荐答案
您需要编写一个服务器端脚本解析从URL或查询字符串中的脚本名,并把所有的内容的单个响应脚本。
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.
请务必读取任意文件验证脚本名称为prevent袭击者。
Make sure to validate the script names to prevent attackers from reading arbitrary files.
这篇关于使用一个脚本标记多个外部JavaScript文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!