Dynamically add image to web page head using Javascript - will browser fetch image?
If I were to dynamically add an image to a web page from JavaScript, and I add that image to the <head> section, then if I set the image src property, will the browser fe开发者_JS百科tch that image for me or will it not bother because as it doesn't display images from the <head> section in the rendered page, there is no point fetching it?
On IE8, it still fetched it, but I'm wondering if I can rely on that behavior on all browsers?
The only way you could know is through testing. It should be pretty easy to test with a large image, a collection of browsers, and a network bandwidth monitor.
Even if you can find that most major browser do this, I still wouldn't rely on it.
Why would you want to?
精彩评论