Synthesis 6 Branding > Custom Javascript allows you to inject custom Javascript into your site globally so that it is executed on every page. To do so, you must first convert the code into pure Javascript.
Embed codes frequently leverage <script src=""> tags to sideload hosted scripts.
Using the code example below, external scripts can be sideloaded within Javascript. Replace the URL in the getFile() function call statement on the last line with the src= value from the original <script src=""> tag.
function getFile(filePath) { var httpRequest = new XMLHttpRequest(); if (!httpRequest) { alert('Cannot create an XMLHTTP instance'); return false; } httpRequest.onreadystatechange = function() { if (httpRequest.readyState === XMLHttpRequest.DONE) { if (httpRequest.status === 200) { eval(httpRequest.responseText); } else { alert('There was a problem with the request.'); } } }; httpRequest.open('GET', filePath); httpRequest.send(); } getFile("https://foo.bar/script.js");
NOTE: If sideloading multiple scripts, include the getFile() function one time and repeat the getFile(""); function call for each each external script.