在使用d3.text时避免数据高速缓存 [英] Avoid data caching when using d3.text

查看:618
本文介绍了在使用d3.text时避免数据高速缓存的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用d3.text()加载文本文件。我想避免使用浏览器的缓存。任何人都知道如何这样做?
谢谢!

I am using d3.text() to load a text file. I want to avoid using the cache of the browser. Anybody knows how this can be done? Thanks!

推荐答案

不了解MIME类型如何处理这个问题。

Don't see how the MIME type would do anything for this issue.

你可以通过向url附加一个随机数来避免缓存(这是一个与d3无关的通用实践)。因此,如果您的网址是

You can avoid caching by appending a random number to the url (this is a general practice that has nothing to do with d3). So, if your url is

var url ='http://www.example.com/somthing';

var url = 'http://www.example.com/somthing';

然后提出您的要求

 d3.text(
   url + '?' + Math.floor(Math.random() * 1000)
 );

更多信息此处

这篇关于在使用d3.text时避免数据高速缓存的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆