Tech projects, hobby programming, and geeky thoughts of Paolo Amoroso

Keeping track of visited URLs in WebCard

WebCard has very limited control over the web browser of the host operating system.

It can only command the browser to visit a URL when the user traverses a Web link or executes the Visit URL menu command. But with no precautions the browser would open a new tab for every visit of the same URL.

To reduce clutter I tweaked WebCard to keep track of visited URLs. The URLVisitedP boolean property of a Web card window indicates whether the associated URL was already visited. The function WCD.TraverseWebLink checks URLVisitedP and visits the URL only if the property is NIL, then sets it to T if it does visit the URL. URLVisitedP is a property of the window rather than the card because, as part of the dynamic session state, NoteCards shouldn't save it in notefiles.

The overall behavior of Web cards and URL visits appears as follows.

Traversing the link of a closed Web card unconditionally visits the URL. Once the card is open, traversing the link again flashes the card to call attention to it but doesn't visit the URL. The Visit URL menu command can force the visit though. Closing a card sets URLVisitedP to NIL, so the next time link traversal reopens the card it triggers a visit.

This should take care of the most common cases of unintentional link traversal, reduce tab clutter, and prepare WebCard for actual usage.

#WebCard #Interlisp #Lisp

Discuss...
Email | Reply @amoroso@fosstodon.org