function - Is it possible to intercept http calls to images and change them with javascript? -


i want add arguments images in website, these dynamic. unfortunately (only) way have intercepting image before loading. javascript way go here since can change header. third party libraries jquery not option.

something like: http://www.example.com/acme.jpg

would captured , transformed into

http://www.example.com/acme.jpg?v=120

the way see javacript have be, inline, in header of page, before images start load. don't need change html itself, intercept when browser calls image , tweak bit ilustrated.

is possible?

you try jquery solution :

$(function() {   $( "img" ).load(function() { // select images here       var src = $( ).attr("src");       $(this).attr("src", src + "?v=120" ); // set new url here   }); } 

Comments

Popular posts from this blog

python - Mongodb How to add addtional information when aggregating? -

java - Spring Data JPA: Why findOne(id) executing delete query internally? -

ruby - Net::HTTP extremely slow responses for HTTPS requests -