Autoversioning externally linked content
So I'm building a javascript library meant to be loaded by external domains. I'm looking for a good way to do auto-versioning for this. Ideally, the external domain should be 开发者_Python百科able to just write <script src="<filename>" type="text/javascript"></script>
and somehow have that version correctly.
The best solution I can think of is to have the <filename>
point to a page, built using a server-side language, that dynamically includes the right javascript libraries with the right versioning. The problem with this is that it requires the javascript to be dynamically loaded and means that our server will be hit on every load (ie it can't be cached).
Any ideas?
Refer to this link.
http://blog.sallarp.com/asp-net-automatic-css-javascript-versioning/
This tells us about creating custom control for script tag, link tags(css) and then emits the static contents using the dummy querystring saying ?version=1.2.3
精彩评论