URL @Functions in the Extension Library
There are a few @Functions for working with URLs available in the Extension library. They can come in handy if you need to work with URLs related to any element in your database.
These functions are part of the extension library. They’re available if you’ve installed the Extension Library, or if you have Upgrade Pack 1 for 8.5.3. They’re also part of the extension library features built directly into Notes9.
The functions are available on the Reference tab in the SSJS Script Editor. Under
@FunctionsEx to see the additional functions.
The following URL functions are available:
- @EncodeUrl() – Encodes spaces and symbols in the URL
- @FullUrl() – Displays the full path to a resource in the database (relative to the server)
- @AbsoluteUrl() – Displays the absolute path to a resource in the database*
- @IsAbsoluteUrl() – Boolean value for whether a given URL is absolute
Here are some examples of how they can be used in an application:
Where the url is: http://127.0.0.2/BlogTesting.nsf/ExtLibURLFormulas.xsp?my_Parameter=spaces and $ymbol$
I generally use
context.getUrl() and work with that to parse and build URLs, so I haven’t run into this before, but the output of @AbsoluteUrl() wasn’t what I expected. At first glance, it appeared to give the full url to the specified design element, but it actually just gives the protocol, server, and design element name that was supplied.
It looks like I can get the real absolute url to the design element by combining @FullUrl() with @AbsoluteUrl()