JSFiddle - React, Tailwind, and code Playground
by amirshim
JavaScript
$(function() {
var use_unique_name = true;
var imgsrc = 'http://www.jaavuu.com/content/1/slides/jaavuu-one-event-one-gallery.jpg';
if (use_unique_name) {
var ts = +new Date;
// try replacing _= if it is there
var ret = imgsrc.replace(/(\?|&)_=.*?(&|$)/, "$1_=" + ts + "$2");
// if nothing was replaced, add timestamp to the end
imgsrc = imgsrc + ((ret == imgsrc) ? (imgsrc.match(/\?/) ? "&" : "?") + "_=" + ts : "");
}
var loader = $('<iframe name="test1" id="test2" />').appendTo('body');
loader.load(function() {
setTimeout(function() {
$('body').append('loaded<br/>');
var im = $('<img/>');
im.attr('src', loader[0].src);
$('body').append(im);
}, 1000);
});
loader.attr('src', imgsrc);
if (0) setTimeout(function() {
$('body').append('canceling<br/>');
loader.remove();
}, 1110);
});