javascriptxpageslotus-dominodomino-designer-eclipse

Reference javascript file in domino/html directory on xpage


On xpages it appears that you can add javascript resouces that are installed in the database or from a URL. I'd like to reference a javascript file that's in my domino/html directory on the server without having to write the full URL including domain name in the javascript field on the dialog box.

I can work around this by using ../../ in the src attribute but that means I have to know where in the folder structure my .nsf is, which is less than ideal.

Is is possible to reference the root directory directly? If so how do I do it?

enter image description here


Solution

  • I use the following.

    <xp:script
                src="${context.url.scheme}${'://'}${context.url.host}/script.js"
                clientSide="true"
                type="text/javascript">
    </xp:script>