¿Por qué mi archivo javascript no se carga en mi página?

There is a script file that I wrote. I included it to my page at the top of codes in head tag after 3 other scripts. The others works as well but the last one that I said, never gonna be load into the page. I had same problem like this many times ago but I cant remember how I fixed it.

Here's the question for me. Why others works, but this script not. And of course when I went to the Browser View Source at runtime and I clicked on this script link it gave me this error:

The requested URL /dreamfactory/mainsite/scripts/bbcodeeditor.js was not found on this server

I'm running on localhost and all scripts are in the scripts folder. Like jQuery, and a Main script. (There is no conflict).


Sorry for bringing up this question but I should write something that might be helpful to a reader some day. If you've linked your file in the page and it's not getting loaded, the number 1 reason is that you have an error in that script file. For detecting your script you can run developers tool(like Firefox's Web Console) provided in browsers and go to the Console tab to see what line is causing the problem. Be sure to check your file with one or two browsers. I saw that the Firebug does not warn about the syntax(e. g. defining a default parameter ..., arg = '') in javascript which is wrong thing) in your script file so I used FF, IE or Chrome developers tool for example.

preguntado el 09 de enero de 11 a las 09:01

If you get "File not found" this problem got nothing to do with JavaScript. Something went wrong with your server. -

Are you sure you referenced it correctly in the page? Are you certain it is in the right folder? Can you post your HTML, where you are including the file? -

I hope so ShadowWizard. Because everything in my codes are correct. -

I examined it for million times ! Oded. I cant send it by single because It's in a bigger project. -

1 Respuestas

So there is nothing wrong with the way you've included the script on your page. The error message says it all: the script is not being found by your server. Check:

  • The script is there on the filesystem
  • Script name is correct
  • That the path and filename have the correct capitalisations (upper, lower casing)

Respondido el 09 de enero de 11 a las 12:01

You were right. But something happened to me that I never forget it. First I added runat="server" attribute to it and it was fixed. But after that when I omit runat="server", again it was fixed !. I don't know why, but now it's right. And one thing else. I included it again in my page. Maybe it was for my editor. (WeBuilder 2010) - MahanGM

No es la respuesta que estás buscando? Examinar otras preguntas etiquetadas or haz tu propia pregunta.