QuickTip: Get right path when autolaunching an XPage

If you are using relative urls to you resources you might have got the problem with dead images and resources that doesn’t load. The obvious choice is to add the full url to the images.

Snap181

The problem is often related to when you autolaunch an XPage on database open.

Notes Autolaunch Tab

But there is another way than adding the full url for the problem. You need to add a trailing slash to your path then everything will work as expected again. And using these few javascript lines added to your front page onload event or in a script on the page will fix the problem.

var h=window.location.href;
if(h.indexOf(".xsp")==-1){
if(h.substring(h.length,h.length−1)!="/"){
 window.location.href+="/"

}}

Leave a Comment


NOTE - You can use these HTML tags and attributes:
<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>

This site uses Akismet to reduce spam. Learn how your comment data is processed.