logo

Response

« Return to the main article

You are viewing this page out of context. To see it in the context it is intended please click here.

About This Page

Reply posted by David Broscious on Thu 19 Apr 2001 in response to Opening database relative URLs in JavaScript

A couple of "Gotchas"

First, when I tried to implement the function I ran into the problem that some
files end with ".NSF", not ".nsf". Say, for example, my pathname is
"/bob/giggy.NSF: and the url passed in is "pagetoopen", I'd get
"/bob/giggy.NSF/pagetoopen.nsf" when using:


path = location.pathname.split('.nsf')[0] + '.nsf/';


I don't know whether or not there are ucase and lcase equivalents in JavaScript
(I am curious). My solution was to replace the line above with:


path = location.pathname.slice( 1, location.pathname.lastIndexOf("/"))


Second, beware of the the "default target for links in frame" when working with
framesets. I called the function from within anchor tags on a page that served
as the source of the "left" frame. I wanted all of the links to open in the
"right" frame. No matter how I wrote the "target" variable, the function would
not work until I turned off the "default target" property for the "left" frame
(it had been set to "right").


Just a couple of things caveats. It's a great function that has enabled me to
replace forms that I had been using with pages.


Thanks,


David