How useful is this line? [duplicate]

0

I want to know what this line of code inside my HTML does? Why is it that when I delete it the site stops working?

<script src="js/main.js?nocache=<?php echo md5(microtime()) ?>"></script>
    
asked by anonymous 04.06.2016 / 21:24

1 answer

2

It is unlikely that nocache is needed at some point in this script , but only seeing what's inside it to say what. It has apparently been put (as its name already says) for the browser not to cache the script , as the URL will change each time the page is reloaded, and the which is true for the browser cache is the whole set, not just main.js .

However, the reason the site stops working is that it has adopted a dependency pattern for this script . Ideally, this should not happen. That is, the site may not be in its best state but should work anyway. There is technique for this . It is understandable that the site requires the presence of JS and specific scripts to work well, but completely preventing use is often not a good idea.

    
04.06.2016 / 21:52