File download monitoring



  • Is there any way to monitor the files? For example:

    var style_css = 'css/syle.css';
    style_css.onload(function() {
        console.log('css loaded');
    });
    
    var js = 'js/java.js';
    js.onload(function() {
        console.log('js loaded');
    });
    

    Is there anything like this?
    Maybe. phpjshtmlajax or some other language?



  • I can!

    <script onLoad="alert(this.src + ' загружен');" src="https://code.jquery.com/jquery-2.2.4.min.js"></script>

    You can write a function and perform it, then:

    <script>
      function onLoadHandler(obj) {
        alert(obj.src + ' загружен');
      }
    </script>
    

    <script onLoad="onLoadHandler(this);" src="https://code.jquery.com/jquery-2.2.4.min.js"></script>




Suggested Topics

  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2