Hi All, I have a website with different size banners(i.e 300x250, 250x250 etc) and my users will be using banners in their website which is impacting my server. I want to change the image url to CDN services. I google and came across some script like below. <script type="text/javascript"> var var1 = "iIstCY91tAP0vrnRkRRHDJwiJLI%2B%2Fo%2BlBJLHzcuirsc%3D"; var var2 = "psbdSj1LcyQYdAOBHfcYcz1%2BEggPzzZ0rhwQuU0dQVo%3D"; var var3 = "uf5AbqVIq1pNO5phXnHmZVmQhVjvirI40rIw9wP19dY%3D"; var var4 = "jT0FxqMeOWlnbPzTV7FD8TQXrvu9N9PxQPefY%2Ft7ryw%3D"; var network = "abc.com"; </script> <script type="text/javascript" src="http://abc.com/js/ads.js"></script> Code (JavaScript): JS file code: var _0x36f7= ["\x6C\x6F\x63\x61\x74\x69\x6F\x6E","\x72\x61\x6E\x64\x6F\x6D","\x66\x6C\x6F\x6F\x72","\x72\x65\x66\x65\x72\x72\x65\x72","\x3C","\x73\x63\x72\x69\x70\x74\x20\x74\x79\x70\x65\x3D\x22\x74\x65\x78\x74\x2F\x6A\x61\x76\x61\x73\x63\x72\x69\x70\x74\x22\x20\x73\x72\x63\x3D\x22\x68\x74\x74\x70\x3A\x2F\x2F","\x2F\x61\x70\x70\x2F\x61\x64\x73\x2F\x69\x6E\x64\x65\x78\x2E\x70\x68\x70\x3F\x76\x61\x72\x31\x3D","\x26\x76\x61\x72\x32\x3D","\x26\x76\x61\x72\x33\x3D","\x26\x76\x61\x72\x34\x3D","\x26\x76\x61\x72\x35\x3D","\x26\x76\x61\x72\x36\x3D","\x22\x3E\x3C","\x2F\x73\x63\x72\x69\x70\x74\x3E","\x77\x72\x69\x74\x65"]; if(top[_0x36f7[0]]==self[_0x36f7[0]]) {var var5=Math[_0x36f7[2]](Math[_0x36f7[1]]()*99999999);var var6=escape(document[_0x36f7[3]]);document[_0x36f7[14]](_0x36f7[4]+_0x36f7[5]+network+_0x36f7[6]+var1+_0x36f7[7]+var2+_0x36f7[8]+var3+_0x36f7[9]+var4+_0x36f7[10]+var5+_0x36f7[11]+var6+_0x36f7[12]+_0x36f7[13]);}; Code (JavaScript): I want separate codes for different size banners and my banner url is something like below http://dropboxpro.ru/images/dropbox_pro_main03.jpg [ONLY FOR EXAMPLE] http://cdn.slashgear.com/wp-content/uploads/2012/04/skydrive.jpg [ONLY FOR EXAMPLE]
Why don't use svg image. It's pretty small in size, responsive, and more. Base64 image is fast but it will bloat your file size up by 33%. Just my 2 cents...
I'm stuck wondering why you think you need javascript for image links -- just put the URI in the blasted markup normally. If it's from a different path, include that path. It's not rocket science, stop trying to turn it into such. But to be fair, I think 90%+ of the nonsense people are throwing scripting at these days is just pointless bloat, stuff that would be better handled server-side, mixed with a lack of understanding how HTML and CSS works.
javascript can be useful if you want to pick up some client stats and you don't want the 3rd party to know what you are up to.
You can however do most of the javascript statistics serverside if you're hosting these ads yourself. Logs will show how and when each is shown, and if you proxy click-thtoughs, you can log that as well (if the ads are for external sites). But yeah, a javascript alternative might work just fine for ads on external sites.
In which case you hook the anchors for reporting; (either server-side pass-through on the URI or client-side AJAX) -- still has nothing to do with SHOWING the images, or the markup that should be used to show them.