Home » Javascript » javascript code first time not working but if i click inpect element it works [on hold]

javascript code first time not working but if i click inpect element it works [on hold]

Posted by: admin August 19, 2018 Leave a comment

Questions:

This code doesn’t work until clicking inspect element in the browser development tools. Once inspect element is enabled and closed, then it works perfectly. Could you help me understand why this is?

this.page.url = PAGE_URL; // Replace PAGE_URL with your page's canonical URL variable
this.page.identifier = PAGE_IDENTIFIER; // Replace PAGE_IDENTIFIER with your page's unique identifier variable
};

(function() { // DON'T EDIT BELOW THIS LINE
    var d = document,
    s = d.createElement('script');
    s.src = 'something.js';
    s.setAttribute('data-timestamp', +new Date());
    (d.head || d.body).appendChild(s);
})();
Answers: