Date: Fri, 12 Oct 2001 09:22:50 +0100 From: Mark Drayton <mark.drayton@izr.com> To: freebsd-questions@freebsd.org Subject: Re: Way Off Topic: Bookmarks Message-ID: <20011012092250.A56839@drex.staff.izr.com> In-Reply-To: <20011011155352.G3862@acadia.ne.mediaone.net>; from leblanc%2Bfreebsd@smtp.ne.mediaone.net on Thu, Oct 11, 2001 at 03:53:52PM -0400 References: <Pine.NEB.4.33.0110110259560.383-100000@sdf.lonestar.org> <20011011203843.A46417@drex.staff.izr.com> <20011011155352.G3862@acadia.ne.mediaone.net>
next in thread | previous in thread | raw e-mail | index | archive | help
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{<a href="$url">$title</a><br>\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
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20011012092250.A56839>