Hello!
I need to insert <script src="https://xxxxx.js" async></script>
into a topic, just ONE topic.
I knew this:
But it is possible to use javascript to check the url and if it match, insert the js?
Hello!
I need to insert <script src="https://xxxxx.js" async></script>
into a topic, just ONE topic.
I knew this:
But it is possible to use javascript to check the url and if it match, insert the js?
After typing this, an idea hit my head:
<script type="text/javascript">
if(window.location.href === "https://my-forum.com/t/xxxxx/1234567") {
var head = document.getElementsByTagName('head')[0];
var script = document.createElement('script');
script.type = 'text/javascript';
script.src = 'https://xxxxxxx.js';
head.appendChild(script);
}
</script>
Itβs working fine !
This topic was automatically closed after 2267 days. New replies are no longer allowed.