0
console.log('messages-list script loaded');

document.addEventListener('turbolinks:load', function(){
    console.log('turbolinks:load');
});

I'm trying to listen to this event but it is not firing in my script.js. If I paste this in console of chrome browser then it works. Only first console.log statement works.

  • Check [context selector](https://developers.google.com/web/tools/chrome-devtools/console/reference#context) in console toolbar - does it say "top"? – wOxxOm Apr 16 '20 at 06:45
  • Yes, it say "top". If I reload the page then the listener defined in my script.js file works. – Ramandeep Bhagat Apr 16 '20 at 12:22
  • Can't tell the exact cause but you can run that code in [page context](/q/9515704/), which is the same environment used when running in devtools console with the default context ("top"). – wOxxOm Apr 16 '20 at 12:30

0 Answers0