bootstrap怎么处理缓存问题


当前第2页 返回上一页

1

2

3

4

5

6

7

8

9

10

11

12

13

14

15

16

17

18

19

20

21

22

23

24

25

26

$(document).on('click.bs.modal.data-api', '[data-toggle="modal"]', function (e) {

  var $this   = $(this)

  var href    = $this.attr('href')

  var $target = $($this.attr('data-target') || (href && href.replace(/.*(?=#[^\s]+$)/, ''))) //strip for ie7

  var remoteUrl = !/#/.test(href) && href

  if (remoteUrl == undefined) {

      remoteUrl = "";

  }

  if (remoteUrl.indexOf("?") > -1) {

      remoteUrl += "&" + (new Date()).valueOf()

  }

  else {

      remoteUrl += "?" + (new Date()).valueOf()

  }

  //var option  = $target.data('modal') ? 'toggle' : $.extend({ remote: !/#/.test(href) && href }, $target.data(), $this.data())

  //上边的是原代码,增加了remoteUrl来解决IE下缓存的问题

  var option = $target.data('modal') ? 'toggle' : $.extend({ remote: remoteUrl }, $target.data(), $this.data())

 

  e.preventDefault()

 

  $target

    .modal(option, this)

    .one('hide', function () {

      $this.is(':visible') && $this.focus()

    })

})

注释已经说明了解决办法,我只是增加了remoteUrl,在请求的url后加上时间,这样就不用一个一个的修改,也能兼顾各个浏览器了。

以上就是bootstrap怎么处理缓存问题的详细内容,更多文章请关注木庄网络博客

返回前面的内容

相关阅读 >>

bootstrap基本结构有哪些

bootstrap可以更改样式吗

bootstrap字体图标怎么引用

bootstrap模态框有哪些

bootstrap如何设置字体

bootstrap有哪些插件

bootstrap如何兼容ie6

bootstrap整体架构包含哪些模块

bootstrap用哪个版本

vue能用bootstrap

更多相关阅读请进入《bootstrap》频道 >>




打赏

取消

感谢您的支持,我会继续努力的!

扫码支持
扫码打赏,您说多少就多少

打开支付宝扫一扫,即可进行扫码打赏哦

分享从这里开始,精彩与您同在

评论

管理员已关闭评论功能...