javascript - How can I prevent an external JS file from breaking my site? -
I am currently using the mixpell on my site. For some reasons they go down from time to time and disables my site loading.
Is there any way that I can consider loading async or something else where it does not bring down my site downtime?
Here is the code:
& lt; Script & gt; Var mp_protocol = (("https:" == document.location.protocol)? "Https: //": "http: //"); Document.write (unescape ("% 3Cscript src = '" + mp_protocol + "api.mixpanel.com/site_media/js/api/mixpanel.js' type = 'text / javascript'% 3E% 3C / script% 3E") ); & Lt; / Script & gt; thanks
Do not document. Write it on the page, add it.
& lt; Script & gt; $ (Function () {var mp_protocol = (("https:" == document.location.protocol)? "Https: //": "http: //"); jQuery.getScript (unseaspeep (mp_protocol + "api. Mixpanel.com/site_media/js/api/mixpanel.js "));}); & Lt; / Script & gt;
Comments
Post a Comment