From owner-freebsd-questions Fri Oct 12 1:22:56 2001 Delivered-To: freebsd-questions@freebsd.org Received: from drex.staff.izr.com (drex.staff.izr.com [195.26.38.16]) by hub.freebsd.org (Postfix) with ESMTP id 4E38437B403 for ; Fri, 12 Oct 2001 01:22:52 -0700 (PDT) Received: by drex.staff.izr.com (Postfix, from userid 1001) id BADBF337A9; Fri, 12 Oct 2001 09:22:50 +0100 (BST) Date: Fri, 12 Oct 2001 09:22:50 +0100 From: Mark Drayton To: freebsd-questions@freebsd.org Subject: Re: Way Off Topic: Bookmarks Message-ID: <20011012092250.A56839@drex.staff.izr.com> Mail-Followup-To: freebsd-questions@freebsd.org References: <20011011203843.A46417@drex.staff.izr.com> <20011011155352.G3862@acadia.ne.mediaone.net> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.2.5i In-Reply-To: <20011011155352.G3862@acadia.ne.mediaone.net>; from leblanc+freebsd@smtp.ne.mediaone.net on Thu, Oct 11, 2001 at 03:53:52PM -0400 Sender: owner-freebsd-questions@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG Louis LeBlanc (leblanc+freebsd@smtp.ne.mediaone.net) wrote: > On 10/11/01 08:38 PM, Mark Drayton sat at the `puter and typed: > > what ever (thursday@sdf.lonestar.org) wrote: > > > I'm wondering what people are doing to manage their bookmarks. In > > > my home office, I find myself switching between Netscrape on my > > > Windows machine, and between Konqueror & Netscrape on my FreeBSD > > > machine. I mostly use the FreeBSD machine for surfing, but my > > > NN/Win instance had the biggest bookmarks file (years of surfing > > > on that platform before I found the *nix light). > > > > I have a web page on my server with all my commonly used bookmarks. > > I store all the bookmarks in an XML file (easier to edit) which is > > then turned into HTML by a CGI script. > > > > I also have a bookmark in IE that adds the current page to an HTML > > document using a couple of Javascript functions (to get the current > > URL and page title). Perhaps one day I'll change this to add the > > site to my bookmarks.xml file... If anyone is interested I'll post > > the script and Javascript to add the URLs tomorrow when I get to > > work. > > Of course. Even if I can't set it up now, It'd be nice to save for a > future project. I'm not sure what I'd prefer to do, but it seems a > bookmark to a javascript tool might be a cool way to do that. From a > page you want to bookmark, just select the bookmark to the javascript, > and it can grab the page you're on and dump it into the script. > > The javascript must just feed the last visited url to the cgi script, > which can then fetch the title. From there, perl can dump it into an > xml or html page pretty easily, just leave a commented tag where the > next one has to be inserted, or even sort it, categorize it, whatever. > The whole thing could actually live on the server. Ok, here is the Javascript. Make this the target of a bookmark/favorite (I've only tried it with IE): javascript:location.href="http://example.com/bookmarks/append.pl?title="+document.title+"&url="+document.URL And here's append.pl: #!/usr/bin/perl -w use strict; use CGI; my $cgi = CGI->new; my $broken = 0; my $bookmarks = '/home/htdocs/bookmarks/bookmarks.html'; my $url = $cgi->param('url') || ($broken = 1); my $title = $cgi->param('title') || ($broken = 1); if ($broken) { print $cgi->header; print "URL and/or title not supplied\n"; exit 1; } open(BOOKMARKS, ">>$bookmarks") || die "can't open $bookmarks\n"; print BOOKMARKS qq{$title
\n}; close(BOOKMARKS); print "Location: $url\n\n"; exit 0; This whole lot works reasonably well, apart from slightly mucking up your browser history by using location.href and Location:. Feel free to fiddle. Cheers, -- Mark Drayton To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-questions" in the body of the message