If an xp:link url starts with /, it generates the path to the current application at the start of the url. If you want to link to another app/page on the current server you either have to make an html link (<a>), hard code the path, or use something like this function.
// Returns absolute path (including protocol/hostname) to the current application
// or specified [database]
function getAppPath( db:NotesDatabase ){
try {
var currentUrl = context.getUrl();
var hostname = currentUrl.getHost();
var protocol = currentUrl.getScheme();
db = db || database;
return protocol + '://' + hostname + '/' + db.getFilePath().replace( /\\/g, '/' );
} catch( e ){ /* Exception handling */ }
}
1 comments:
Please note that sometimes server needs to use other port than default(80). Therefore it's good to check that also:
port = (request.getServerPort().equals(80)) ? "" : ":" + request.getServerPort();
Post a Comment