Cached js doesn't execute
-
I have this simple headlines.js in the body of my front page:
'keywords = [
"Headline text one",
"Headline text two",
"Headline text three",
"Headline text four"
]
var keyword = keywords[Math.floor(Math.random()*keywords.length)]
document.write(keyword);'
Which is loaded using this code:
'<script type='text/javascript' src="<?php echo get_template_directory_uri(); ?>/assets/js/theme/headlines.js"></script>'
I’m using Autoptimize in conjunction with W3 Total Cache. Headlines.js runs perfectly and updates the headline on every page view only when excluded from Autoptimize.
How can I avoid excluding headlines.js and have it work properly?
Thanks,
Brian
Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
- The topic ‘Cached js doesn't execute’ is closed to new replies.