Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Avoid data caching when using d3.text

Tags:

d3.js

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!

like image 356
elachell Avatar asked Oct 24 '12 16:10

elachell


1 Answers

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

like image 114
meetamit Avatar answered Jan 02 '23 19:01

meetamit