Avoid data caching when using d3.text

前端 未结 1 1720
眼角桃花
眼角桃花 2020-12-19 09:32

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!

相关标签:
1条回答
  • 2020-12-19 10:22

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

    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';

    Then make your request

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

    More info here

    0 讨论(0)
提交回复
热议问题