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

查看:19
本文介绍了使用 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';

然后提出您的要求

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

更多信息 此处

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

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