So, I have this small javascript code.
<script type="text/javascript">
function showModalCS() {
if (window.location.href == "http://domainname.com/check/") {
document.writeln('<link rel="stylesheet" href="http://domainname.com/style.min.css" />');
document.writeln('<div id="popup"><span class="button b-close"><span>X</span></span><img src="http://domainname.com/image.png" alt="" /></div>');
document.writeln('<script src="http://cdnjs.cloudflare.com/ajax/libs/jquery-easing/1.3/jquery.easing.min.js" /><script src="http://domainname.com/script.min.js" />');
$("#popup").bPopup();
} else {
//
}
}
showModalCS();
</script>
It works fine when I put it inside an html file and upload it using cpanel file manager.
But, when I use joomla's template manager to add this script to the bottom of the index.php
it doesn't work. Instead I get an Unexpected Identifier error in chrome's dev tools...
Any ideas on how to fix this?
change you last script tag to
</script>
Script tag can never be self closing try this instead
document.writeln('
<script src="http://cdnjs.cloudflare.com/ajax/libs/jquery-easing/1.3/jquery.easing.min.js">
</script><script src="http://domainname.com/script.min.js"></script>');