Created
April 19, 2016 00:48
-
-
Save karlcow/6c89d2f74471d966f4d5613b8af3e7f3 to your computer and use it in GitHub Desktop.
Amazon is targetting Firefox with a bad technique https://bugzilla.mozilla.org/show_bug.cgi?id=1172205 Mozilla fixed a bug but as of today Amazon didn't change yet their script.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
amznJQ.available("jQuery", function() { | |
jQuery(window).load(function() { | |
setTimeout(function() { | |
var imageAssets = new Array(); | |
var jsCssAssets = new Array(); | |
imageAssets.push("https://images-fe.ssl-images-amazon.com/images/G/09/x-locale/common/buy-buttons/review-1-click-order._CB171143523_.gif"); | |
imageAssets.push("https://images-fe.ssl-images-amazon.com/images/G/09/x-locale/common/buttons/continue-shopping._CB192262037_.gif"); | |
imageAssets.push("https://images-fe.ssl-images-amazon.com/images/G/09/x-locale/common/buy-buttons/thank-you-elbow._CB192261665_.gif"); | |
imageAssets.push("https://images-fe.ssl-images-amazon.com/images/G/09/x-locale/communities/social/snwicons_v2._CB383421867_.png"); | |
imageAssets.push("https://images-fe.ssl-images-amazon.com/images/G/09/checkout/assets/carrot._CB192555707_.gif"); | |
imageAssets.push("https://images-fe.ssl-images-amazon.com/images/G/09/checkout/thank-you-page/assets/yellow-rounded-corner-sprite._CB192555699_.gif"); | |
imageAssets.push("https://images-fe.ssl-images-amazon.com/images/G/09/checkout/thank-you-page/assets/white-rounded-corner-sprite._CB212531219_.gif"); | |
jsCssAssets.push("https://images-na.ssl-images-amazon.com/images/G/01/browser-scripts/jp-site-wide-css-beacon/site-wide-6800426958._V1_.css"); | |
jsCssAssets.push("https://images-na.ssl-images-amazon.com/images/G/01/browser-scripts/site-wide-js-1.2.6-beacon/site-wide-3750999928._V1_.js"); | |
// pre-fetching image assets | |
for (var i = 0; i < imageAssets.length; i++) { | |
new Image().src = imageAssets[i]; | |
} | |
// pre-fetching css and js assets based on different browser types | |
var isIE = /*@cc_on!@*/ 0; | |
var isFireFox = /Firefox/.test(navigator.userAgent); | |
if (isIE) { | |
for (var i = 0; i < jsCssAssets.length; i++) { | |
new Image().src = jsCssAssets[i]; | |
} | |
} else if (isFireFox) { | |
for (var i = 0; i < jsCssAssets.length; i++) { | |
var o = document.createElement("object"); | |
o.data = jsCssAssets[i]; | |
o.width = o.height = 0; | |
document.body.appendChild(o); | |
} | |
} | |
}, 2000); | |
}); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment