Reputation: 23901
I know you can't pass a parameter to a javascript file via variables after a URL (the way you can with php). - Passing parameters to JavaScript files - Can you pass URL parameters to a Javascript file?
But I am looking at live code from a production site that looks like this:
<script type="text/javascript" src="/sites/default/files/js/gmap_markers.js?f"></script>
If the ?f
is not a parameter, then what is it doing?
Upvotes: 0
Views: 106
Reputation: 180787
That's not a Javascript parameter; it's an URL parameter. It governs the manner in which the script itself is downloaded from the website.
<script type="text/javascript"
src="https://maps.googleapis.com/maps/api/js?key=API_KEY&sensor=SET_TO_TRUE_OR_FALSE">
</script>
For example, a change in the letter of the parameter in the example in your question could be a change in the version of the Javascript. Changing the f
to a g
invalidates the browser cache, and forces the browser to download the new version.
Upvotes: 2