Reg Exp
Web Design
Notes Client
Include jQuery On Every XPage
For a recent project, I was doing a little bit of stuff with jQuery. Not a lot, but some manipulation of URL's and things (that will be discussed in another post). I wanted to make sure that I had jQuery available on every page. This is actually easy to do - you don't have to remember to include it as a resource all the time. In fact, this can be used for any client-side resource you will always need (JS file, CSS file, etc).

First, download jQuery. I downloaded jquery-1.8.2.min.js from the web. Store this as a file resource. Yes, it's a JavaScript file. But instead of importing all the code into a JS file and potentially messing up formatting, I just put it as a file resource.

Next, go into your theme. If you don't have one, create one. But you really should have one - start with oneUI if nothing else.

Add the following lines into your theme:

Finally, if you had to create a theme, make sure that theme is being used on the XPages tab of Application Properties.

You can do the same thing with a CSS file, like I had one that overrides some of the OneUI CSS: