[Solved] How to add a dynamic query string to a link?
If you want to prevent caching you could also just use the current timestamp instead of random number. The following code snippet finds every link on the page containing “pdf” and adds either ?r={timestamp} or &r={timestamp}. var timestamp = new Date().getTime(), links = document.querySelectorAll(“a[href*=pdf]”); for (var i = 0, l = links.length; i < l; … Read more