3

The Live Edit feature of Webstorm 8 doesn't seem to work when using an external JavaScript file (i.e. when included with <script src="script.js"></script> in my HTML). Changes in the external JavaScript file appear only after I refresh the page.

Things work just fine for other scenarios - e.g. when I start debugging, the page in Chrome gets updated when I make changes to the HTML or CSS files, and things also work when I write some JavaScript code between <script> and </script> tags in the HTML.

What could the problem be?

Bangiev
  • 33
  • 4
  • I'm having the same problem, If I work in an AngularJS project everything seems to work fine, but If I create a empty project and add a html and link an external js file. LiveEdit doesn't work. Did you figure out how to enable LiveEdit with Ext JavaScript files? – Juancarlos Rodríguez Jul 26 '14 at 10:21
  • Same problem here. Only changes in the HTML document itself are automatically shown in Chrome. I still have to reload the page manually after changing the JS or CSS files. – Kokodoko Mar 19 '16 at 13:16

1 Answers1

4

Actually Live Edit works in both cases. But changes in embedded javascript always cause page reloading, whereas changes in 'external' javascript are hotswapped - just as for HTML and CSS. But not each and every change in external javascript code results in immediate page update: new code is loaded to the browser instantly, but the results of the change will be visible only when you do something to trigger this new code. For example if you change the onClick handler and write new text in alert, you will see the new text after the click without reloading the page. Same for functions triggered by timer But if the JS code is executed only on page load (and not on certain event), you have to manually reload the page to see the results - live edit doesn't force new code execution

Note also that hotswapping doesn't currently work for file-level variables due to Chrome limitations - see WEB-7390

lena
  • 90,154
  • 11
  • 145
  • 150
  • Thank you, lena, for your quick and thorough explanation! – Bangiev Jun 04 '14 at 19:16
  • But if all your JS code only executes on page load, you can never live view any JS changes? And what about CSS? I dont' see updates in my CSS either. Is there a way to force the browser to simply reload (F5) after saving a file in Webstorm? – Kokodoko Mar 19 '16 at 13:18