Relative links in Notes documents

by Volker Weber

Hubertus wants to author documents in Notes that have relative links to anchors within the same document. In HTML this is very easy.

  1. You create an anchor <a name="mytarget">.
  2. You link to that anchor with <a href="#mytarget">

How do you do that in Notes? A hotspot with a Notes reference always links to THIS document in THIS database. Can you do relative links as well?

This is to be used in a newsletter sent to Notes users in the same domain. The newsletter contains a graphical table of contents, that should link to parts of the document. If you do a "Edit - Copy as Link - Anchor Link" you get the replica ID and the document ID as part of the link. That is not a relative but an absolute link.



You need to create an 'anchor' link using Edit -> Copy as link -> Anchor link (in Windows) to create the anchor then use Paste it whereever you want to 'jump from.

Ian Scott, 2009-01-27

Ah. Just re-read that. It still works though.

Ian Scott, 2009-01-27

Ian, read again:
If you do a "Edit - Copy as Link - Anchor Link" you get the replica ID and the document ID as part of the link. That is not a relative but an absolute link.Anchor links don’t work for this use-case.

Personally, I would look to render the table as pass-thru HTML in the Notes client. But of course, that brings its own challenges... ;o)

Ben Poole, 2009-01-27

1) Create an anchor link at the location where you want to jump to. Name it "jumpy".

2) Create an URL hotspot at the top of the mail (where you want to jump from) and type "#jumpy" as URL.

Worked for me (using Notes 8.5 on a Mac) and should be relative.

Michael Sedlaczek, 2009-01-27

Ian’s right: the replica ID changes with the host database, so although not relative, the links should still be OK?

Ben Poole, 2009-01-27

You can certainly do this, although it requires more logic leaps than you might expect.

Actually, there are two separate scenariors. The first scenario is a link to another spot in the same rich text field, or another rich text field on the same document. In that case, an anchor link works fine.

The second scenario is the more interesting, and likely the one you mean: the ability to create an anchor on the form and have links go to it for any document that uses the form. There are two techniques for this, the first which works only in the Notes client and the second which works from anywhere. The technique which works from Notes is documented in a post I made back in 2003 called Anchors aweigh. The second technique uses some of the same logic, but a bit of undocumented magic. The magic is that if you modify the anchor link (which contains replica id, view unid, note unid and anchor reference), using Midas or the NotesRichTextDoclink classes, to zero out the replica id and view unid and note unid, the link will go to the same document in both Notes and on the web. If you combine that with the first technique mentioned in the post to move the anchor to the form, you have a relative link that works for any document using that form, and with a bit of QuerySave logic, you can ensure that links created in rich text fields can also point at those anchors.

(I'm sorry - does this post mark me idelibly as an incorrigible geek?)

Ben Langhinrichs, 2009-01-27

No, it marks you as the expert. But we already knew that.

Volker Weber, 2009-01-27

I do not see where the problem is. Just send a mail with anchor links from one mailfile to another mailfile, open the mail and klick the anchor links - works just fine.

The difference between a URL and a doclink is that a URL is either valid or not (i.e. 404). The Notes client follows a sequence with multiple fallbacks in locating a doc to a doclink. It seems that a doclink with an anchor link first ignores the replica-id and only uses the replica-id if it cannot locate the anchor within the same dcocument

Felix Binsack, 2009-01-27

sorry folks, all mentioned above does not work for me, but...the lotus script button thing does.

1) create the ancor
2) add hotspot rectangle and switch to lotus script
3) add the following and replace "anchor1" with the anchor name

Sub Click(Source As Button)
Dim ws As New NotesUIWorkspace
Dim uidoc As NotesUIDocument
Dim doc As NotesDocument
Set uidoc = ws.CurrentDocument
Set doc = uidoc.Document
Set uidoc = ws.EditDocument(False, doc, False, "anchor1")
End Sub

we're still using Notes 6.5.1 client here. The problem is editing an existing hotspot. damn gui. but there is a trick that worked for me.
if you create any button in edit mode, you may see the tiled script window and are able to edit the code.

Hope Hubertus can deal with this cause I'm the helpdesk guy that has to fix it. :-)


Frank Simon, 2009-02-20

Dear all, thanks for all the input. It has not been that trivial, but finally Franks solution worked. Sorry for the delay of this "mission accomplished" message.

Hubertus Alvensleben, 2009-03-20

Old archive pages

I explain difficult concepts in simple ways. For free, and for money. Clue procurement and bullshit detection.


Paypal vowe