Skip to main content

Why are my scripts giving 404 errors and "content not found"? They are RIGHT THERE.

To future me (and anyone else who comes across it):

WebContent/ is the root folder for resources. Not WebContent/WEB-INF/. WebContent/WEB-INF/ is actually protected and hidden from the browser, even if you explicitly include it in your URL. So put your /js/ folder and /css/ folder under WebContent/ and not WebContent/WEB-INF/.

Future you will thank you for remembering or for checking here before spending several hours trying to figure out why this isn't working. Again.

You're welcome.

- Past you.

Comments

Popular posts from this blog

Pass data between XPages and existing LS scripts

I'm working on modernizing a fairly hefty application with a lot of existing script libraries which we want to leverage within the XPages environment. Here is a technique that works very well. First, create an in-memory document in SSJS. We can set any input values needed for the back end. Then we pass that document to a LS Agent which can work it's magic using the values set in SSJS and use the same document to return values back to the XPage. Here is how it works in detail:

Fixing FontAwesome for Windows 10

I ran into an issue with FontAwesome a few months back, where a NoCache header was being injected at the server and FA was broken for any partial refresh. I convinced the admin to reverse that setting and all was well until last week... We had some users who were not getting any icons to appear. Ever. We tracked it down to a new Windows 10 setting for IE11 which disallows untrusted fonts. Since we do not set security protocols for our users, and there is no chance of ever convincing those admins to change this policy that they explicitly turned on, I had to find a new solution. I did some searching and it turned out to not be too difficult. First, here is the original implementation. The theme: <control> <name>Icon.Search</name> <property mode="override"> <name>tagName</name> <value>i</value> </property> <property mode="concat"> <name>styleClass</name> <value>fa fa-search...

Move all your code into script libraries

Here is a little tip and the reason behind it: If you have any code on an XPage, replace it with a single function call and move the code to a script library. Example: If you have code like this on your XPage <xp:this.querySaveDocument><![CDATA[#{javascript: var foo = "hi"; var bar="there"; return (foo==bar?True:False);}]]></xp:this.querySaveDocument> Replace it with this <xp:this.querySaveDocument><![CDATA[#{javascript: return foobarQuerySave();}]]></xp:this.querySaveDocument> And create and include a script library with this function foobarQuerySave() {    var foo = "hi";    var bar = "there";    return (foo==bar?True:False); } Even if there is no code there currently, if you think there may ever be a need for it you should add a stub function that just returns true and call it. Here's why: