帮助我理解<脚本SRC =" some.js参数1 =之一;参数2 =两个" />参数、脚本、两个、SRC

2023-09-10 16:24:40 作者:蔸蔸里有颗糖っ

我观察块像下面有时会在网页上。所以我很好奇,想知道这到底是什么呢?或者为什么它写成这样?

I observed chunks like below sometimes on web pages. So i am curious to know what this really does? or why its written in such a way?

<脚本SRC =somefile.js参数1 = 1&放大器;参数2 =两个/>

<script src="somefile.js?param1=one&param2=two" />

我只能辨认出下面的背后几个意向

i can only make out following few intentions behind it

在它不是页面的URL(我指的.aspx / .PHP /的.​​jsp等),所以它不是黑客那种code其中用户可以添加code像这样来传递数据,而无需让用户关注,其标签不呈现在用户界面或执行旧型的AJAX替代 在这种URL参数都是有用的,如果用户不希望JS文件(任何其他资源如图片),以获取缓存。这可以快速的方式来管理缓存

但我无法弄清楚以下

看起来像网页的URL参数,但这些参数反正可读的JavaScript文件,并有一些额外的工具? 请这些参数有什么在这里发挥作用外? 什么是在这里code这样可/使用的其它可能的实际情形?

所以,请提供相同的相关的一些输入

So please provide some inputs related with the same

谢谢

推荐答案

在这样的情况下,源js文件可能(给定的proper服务器配置)实际上有PHP / .NET code在其中,它可以读取这些附加价值。

Running Non-JS Code within .js Extensions

In cases like this, that source .js file might (given proper server-configurations) actually have PHP/.NET code within it, which can read those appended values.

此外,人们将在次追加一个随机字符串,在他们的参考元素的末尾,以避免加载缓存数据。

Additionally, people will at times append a random string at the end of their referenced elements to avoid loading cached data.