首页 > 其他 > 详细

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

时间:2020-05-18 16:19:05      阅读:318      评论:0      收藏:0      [点我收藏+]
<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>

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

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

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!