动态添加script标签,并防止缓存添加时间戳

时间:2020-05-18 16:19:05   收藏:0   阅读:322
<script>
  window.onload = function () {
    var el = document.createElement(‘script‘)
    var el_html = document.querySelector(‘html‘)
    var timetemp = new Date().getTime()
    el.type = ‘text/javascript‘
    el.src = ‘./index.js?timetemp=‘ + timetemp
    el_html.appendChild(el)
  }
</script>

原文:https://www.cnblogs.com/sq652366/p/12911065.html

评论(0
© 2014 bubuko.com 版权所有 - 联系我们:wmxa8@hotmail.com
打开技术之扣,分享程序人生!