Looking for feedback on JS script that automatically tries China CDN when main CDN fails.

I have created the following script in an attempt to automatically load the China CDN if the Main CDN fails to load. The idea is to provide a single script that will work globally including users in China from the same page..

<script type="text/javascript">
a='//tags.tiqcdn.com/utag/account-name/profile/prod/utag.js';
b=document;c='script';d=b.createElement(c);d.src=a;d.type='text/java'+c;d.async=true;
d.onerror = function() {
    a='//tags.tiqcdn.cn/utag/account-name/profile/prod/utag.js';
    b=document;c='script';d=b.createElement(c);d.src=a;d.type='text/java'+c;d.async=true;
    a=b.getElementsByTagName(c)[0]; a.parentNode.insertBefore(d,a);
}
a=b.getElementsByTagName(c)[0]; a.parentNode.insertBefore(d,a);
</script>

I am looking for feedback on potential issues anyone could see with the above method not working on browsers or mobiles.

 

Accepted Solutions (0)

Answers (0)

Ask a Question
Top Kudoed Authors
Top Kudoed Posts