javascripthtmlcssadobe-bracketslive-preview

Brackets live preview won't load Javascript w/ HTML and CSS files


When I open live preview in brackets the page comes up but never finishes loading. Live preview has worked fine while working on HTML and CSS files, but now that I'm incorporating Javascript I am having this issue.

I have re-installed the program twice with no success, restarted my computer, tried running live preview while all extensions were disabled, and have searched through numerous pages on google on how to fix this issue with no solution.

Also it seems that adding the "script" tag (sourced to my javascript file) is causing the issue. When I run live preview without the tag it loads fine.

This has been an issue for some time so any guidance would be GREATLY appreciated. Thanks!

<!DOCTYPE html>
<html lang="en">
    <head>
        <meta charset="UTF-8">
        <title>Section 2: JavaScript Language Basics</title>
    </head>

    <body>
        <h1>Section 2: JavaScript Language Basics</h1>
        <script src="script.js"></script>
    </body>
</html>

I've emptied the Javascript file in an attempt to identify the problem. As stated earlier this code alone would have live preview loading non-stop.

Please let me know if anymore information is needed. Thanks again!


Solution

  • I think it has to something with the directory like which folders you placed it in for example if the .js file is at the same place as the index.html then what you've done should work.

    if not it's in, for example, a folder called "js" then use something like

    <script src="../js/script.js"></script>
    

    play around with

    ../
    

    or

    ./
    

    because I can't tell without seeing your file structure I can't really know what's happening.