GEDCOM Viewer can also be placed on a Web server together with GEDCOM files and used as an applet by people visiting your Web site to browse your GEDCOM files. Setting this up is a little more technical than other aspects of using GEDCOM Viewer. Here is a summary of what you have to do:
On your Web server, create a folder to be used for GEDCOM Viewer and the GEDCOM files to be made available.
Upload copies of the GEDCOM files you want to be made available into the folder you have created.
Upload a copy of the gv.jar
JAR file from the
GEDCOM Viewer installation folder into the folder you
have created. If you have more than one version of
GEDCOM Viewer installed, be sure that you use the
gv.jar
file from the sub-folder corresponding
to the most recent release.
Upload to the folder you have created an HTML file or files
containing the proper code to start the GEDCOM Viewer
applet and point it at a particular GEDCOM file.
This part is more technical, due to compatibility issues
between the various browsers that are in use.
I have made a sample file
available that illustrates the use of the APPLET
HTML tag to cause GEDCOM Viewer to be loaded as an
applet. In this form, the file is pretty simple and easy
to understand. Unfortunately, not all browsers understand
the APPLET
tag. For maximum compatibility,
it is best to use the Htmlconverter
utility that
is distributed with Java distributions to process the
HTML code before uploading it to your web server.
After conversion, the file will look something like
this -- UGH!
If you want to see what actually happens when you view
this file in a browser, look
here.
Note added 1/21/2013:Htmlconverter
is no longer distributed with recent Java distributions, and it is no longer the recommended way to deploy applets so that they will work in as many browsers as possible. Instead, Oracle has created a different mechanism. To date, I haven't had a chance to look into this closely enough to be able to explain what you have to do, so you are somewhat on your own here. I do know that just using the unadornedAPPLET
works just fine in Firefox, but it might not in other browsers.
By editing the sample HTML code
before processing with HtmlConverter
, the following
customizations can be made:
The width
and height
settings
can be changed to change the size of the "Open Viewer"
button that is initially displayed by the applet.
If you set these to zero, the button will be hidden,
but in that case you need to set the LAUNCH
parameter so that the viewer will open as soon as the
applet is started, without waiting for the button to
be clicked.
The value of the GEDCOM
parameter can
be changed from demo.ged
to the name of the
GEDCOM file you want the viewer to load. This can be an
arbitrary URL, though you should be aware that Java and
browsers typically restrict the URLs that can be accessed
by applets to those located in the same folder or on the
same host as the HTML file that caused the applet to be
loaded in the first place.
The value of the BUTTON
parameter can be
changed to modify the text that is displayed on the
button that is displayed to open the viewer.
If the LAUNCH
parameter is set (doesn't matter
to what), the the viewer will open immediately when the
applet starts, without waiting for the button to be pressed.
You can of course also change the NO JAVA!
text to be something else that should be displayed in case
Java cannot be started or the browser just doesn't know
what to do with the code.
Once you have everything in place, try visiting the HTML
file with your browser. If everything is working, you should
see a pop-up window with a message telling you that your
Web server is not licensed to use GEDCOM Viewer,
and displaying the hostname of the Web server.
At this point, you need to obtain a special license key file
customized for your Web server.
You will need to already have purchased a standard license
for GEDCOM Viewer in order to do this.
Use the Get applet license
item from
the Updates
menu of GEDCOM Viewer.
Click on Get license
, then enter the hostname
of your Web server (the one displayed with the "No license"
message) when prompted. After a few moments, a new license
key file named LICENSE_xxx
(where xxx
is the hostname you entered) will be saved in the sub-folder
of the GEDCOM Viewer installation folder
that corresponds to the release you are running.
Upload this file to your Web server and place it in the
folder with the HTML code and gv.jar
files.
After you have done this, the applet should start when you
click on the "Open Viewer" button.
NOTE: Only upload license files named after specific
Web server hosts. Do not upload the main LICENSE
file from the installation folder onto the Web server!
It won't work for the applet, and you will be violating the terms
of the license by making your license key file available to the
entire world for copying.
Note added 1/21/2013: It seems that somewhere between JRE 1.7.0_9 and JRE 1.7.0_11, some mental midgets at Oracle introduced code into the Java libraries so that if an applet opens an HTTP connection back to the server from which it came, and the file that it attempts to retrieve is announced by the Web server as having MIME typeapplication/java-archive
, then the content that the applet sees is not identical to what was sent by the server, but rather has been mutated in such a way that one flag bit has been set in each of the ZIP local file headers. I can only speculate on why somebody might have thought this was a good idea, but it breaks the signature scheme I use to validate the JAR file against the license key file, and the applet reports that it cannot find a license even though you have placed a valid license on the server. The best workaround I have for this at this time is to rename thegv.jar
file on the Web server togv
(no extension),gv.xxx
, or any name that will cause the Web server not to recognize it as a JAR archive. It will then get delivered with some MIME type other thanapplication/java-archive
, the ill-advised mutation code will not kick in, and the applet will be able to validate itself against the license key file. It will of course also be necessary to make a corresponding name change in the HTML code that is used to load the applet.