Support » Plugins » Hacks » Can't link to Javascript files

  • Resolved garethn



    I am running an offline theme in WAMP on Windows 7, and have installed in C:\ rather than Program Files to avoid security issues/annoyances.

    I have used wp_enqueue_scripts twice, firstly for jquery and then jcarousellite. The problem is, the browser can’t ‘see’ jcarousellite. When I click on the link in the HTML file, it throws up a 500 Internal Server Error. This does not happen for jquery, which is linked through wp-include rather than wp-content.

    In header.php this is written thus:


    This comes through as:

    <script type='text/javascript' src='http://localhost/sbl/wp-includes/js/jquery/jquery.js?ver=1.4.4'></script>
    <script type='text/javascript' src='http://localhost/sbl/wp-content/themes/sbl3/scripts/jcarousellite.js?ver=3.1.3'></script>

    Is WordPress causing this or WAMP? I’d be most grateful of any help as I’ve tried everything I can think of!


Viewing 4 replies - 1 through 4 (of 4 total)
  • @gareth,

    wp_enqueue_scripts is trying to queue the script for you using the path details given.

    Is the path as listed above correct? In other words, is that where the js file is actually located? If it isn’t there then your code is pointing both WordPress and WAMP to the wrong location. This will almost certainly throw some sort of error.


    The files are, respectively, in these locations:


    Surely if the first one works then so should the second!?

    Could WAMP, Windows or WordPress prevent access to the latter file like can happen on a server if your permissions are wrong?


    Try to think less in terms of the Windows directory structure (i.e. starting C: etc).

    If you are running WAMP, in your browser I suspect you can directly access:

    Can you also directly access:

    I would guess not. This is either because the file is not at that location (but it looks as though it actually is) or (more likely now) there is a permissions error on the folder meaning that WAMP is denied access to that resource. Check the permissions and make sure WAMP can access the appropriate folders that contain your code.

    Ok, I moved the file to the template folder and it worked so it was definitely a permission issue.

    I’ve created a new folder called /js/ and put it in there and it seems to work. I can’t see a difference in permissions between them, but it works. Must be something I can’t see or a reserved word kind of problem.

    Either way, thanks for your help!


Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Can't link to Javascript files’ is closed to new replies.