Reputation: 33
I am using a web app for my ecommerce store where they only allow you to add javascript via their input box. You are suppose to add javascript without any script tags.
However, I am trying to integrate a 3rd party analytics tools using the following code:
<script type="text/javascript" src="xxxx" async></script>
How can I add this to the input box without using script tags though? Are there alternative methods?
Thks
Upvotes: 1
Views: 2535
Reputation: 943562
Write JS to modify the DOM to insert the script element.
(function () {
const script = document.createElement("script");
script.src = "xxx";
script.async = true;
document.head.appendChild(script);
})();
Upvotes: 6