Strawberry
Strawberry

Reputation: 67918

Why is my .js file going to a 404?

I'm using Wordpress, and I linked some masonry jQuery library files and when trying to visit the .js file, it goes to a 404. However, my custom functions are viewable and so is the jQuery .js file. Why might it be going to a 404? I spent 1 hour trying to figure out why my function wasn't working and it turns out the file wasn't being loaded properly.

This is how I am linking to the jQuery files:

    <script language="javascript" type="text/javascript" src="http://domain.com/js/custom.js"></script>
    <script language="javascript" type="text/javascript" src="http://domain.com/js/jquery.eachdelay-0.0.1.js"></script>
    <script language="javascript" type="text/javascript" src="http://domain.com/js/jquery.masonry.min.js"></script>

For some reason, custom.js works fine, but not the others. I have it uploaded properly. It says "Page not found" when I try to visit the other files in the browser.

Upvotes: 1

Views: 3969

Answers (2)

Strawberry
Strawberry

Reputation: 67918

Here's the conclusion:

I created another file and deleted the old one then renamed the new one with the same name and it didn't work. So, I just ended up creating a file and naming it something other than the original default and then pasted the JS contents in to the new file I made and viola!

I think its a caching problem, I don't know how to fix it and why it happened but this was my solution. Also, people should not be so hasty to assume that the 404 means that I do not know how to upload a file and that I uploaded it to the wrong directory.

Upvotes: 5

Sourav
Sourav

Reputation: 17530

try using an absolute URL path for the js file.

Upvotes: 0

Related Questions