My site loads a pretty large js file the first time a user visits, and I want to write something like "Loading .. for the first time" it the file isn't from cache.
Is this possible in javascript?
My site loads a pretty large js file the first time a user visits, and I want to write something like "Loading .. for the first time" it the file isn't from cache.
Is this possible in javascript?
in your js
var loadedMyJS = true
in your html
<script >
function loadingIndicator(){
document.getElementById('loadingDiv').style.display=''; //to hideit will be 'none'
}
if(typeof(loadedMyJS) == 'undefined'){
loadingIndicator();
}
</script >
What about including a dynamic timestamp at the end, and checking it afterwards?
var t=<?php echo time(); ?>;
At least i'd get an indication after the fact. Or would I mess up other caching mechanisms by updating the file?