Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • Jonas Berling 30 posts 50 karma points
    Dec 12, 2011 @ 11:09
    Jonas Berling
    0

    Javascript file not found

    There is probably something I don't understand about using Javascript in Umbraco...

    I thought I would keep things nice and tidy so I created a .js file under Settings/Scripts in the backoffice. Added my tiny little JS-code, included the file using <SCRIPT...>-tags in the template and tried it. Immediately got an fairly unspecified error that I know is typical when the .js-file cant be found.

    In the backoffice I can see the URL of my JS-file (/scripts/myFile.js). Tried to browse to that URL but I get a 404 error. I then created copy of the file in the document tree root, changed URL in my <SCRIPT...>-block and now it all works!

    Is the Scripts section not to be used like this or what?

  • Stephen 204 posts 246 karma points
    Dec 13, 2011 @ 10:48
    Stephen
    0

    Hey Jonas,

    When you view a script file in Umbraco there is a link to view just below the name of the file...did you get a 404 error when clicking on that?

    Can only think the JS file was not formed correctly as this should work as you expect it to.

    S

  • Jonas Berling 30 posts 50 karma points
    Dec 13, 2011 @ 14:04
    Jonas Berling
    0

    Stephen,
    That is exactly what happens. I follow the link and get a 404 in return. How can the file be "not formed correctly"? I just created a silly test function like this:

    function test()
    {
      alert("Hello");
      return(false);
    }

    Should there be some kind of header info in there as well? Still, that should not give me a 404, should it? And shouldn't the file actually be visible in the file system under /scripts? Right now it isn't.

    /Jonas

  • Stephen 204 posts 246 karma points
    Dec 13, 2011 @ 15:42
    Stephen
    0

    Nah no header info needed in the file...what you are trying to do should work (i just done it on my install) have you checked your security settings on the folder? Also is your install setup as a virtual directry?

    S

  • Rodion Novoselov 694 posts 859 karma points
    Dec 13, 2011 @ 17:39
    Rodion Novoselov
    0

    Hi. Actually it shouldn't be required, but just for test try to add ~/scripts/ to your umbracoReservedPaths application setting.

  • Rodion Novoselov 694 posts 859 karma points
    Dec 13, 2011 @ 17:41
    Rodion Novoselov
    0

    Oh, and another question - is that sort of a "pure" 404 or a "page intentionally left ugly"?

Please Sign in or register to post replies

Write your reply to:

Draft