As I recall I did this some time ago (2005?). I can't find it now, but my
solution was very simple:
-- use jmolSetDocument(0) to prevent document.write().
-- collect all the tags in a variable.
-- pass the variable through a function that creates dom calls from HTML.
Darned if I can't find it right now. It worked like a charm. not too
difficult. Just a matter of parsing the text. I might try to reproduce that,
because it seems there is no simpler method of doing this.
In any case, if you don't need much -- just an applet, then simply hardcode
the object code into your page:
<object name='jmolApplet0' id='jmolApplet0'
classid='java:JmolApplet'
type='application/x-java-applet'
width='400' height='400' >
<param name='syncId' value='459128554942508' />
<param name='progressbar' value='true' />
<param name='progresscolor' value='blue' />
<param name='boxbgcolor' value='black' />
<param name='boxfgcolor' value='white' />
<param name='boxmessage' value='Downloading JmolApplet ...' />
<param name='name' value='jmolApplet0' />
<param name='archive' value='JmolApplet0.jar' />
<param name='mayscript' value='true' />
<param name='codebase' value='.' />
<param name='script' value='select *;load pdb/1crn.pdb' />
<p style='background-color:yellow; color:black;
width:400px;height:400px;text-align:center;vertical-align:middle;'>
You do not have Java applets enabled in your web browser, or your browser is
blocking this applet.<br />
Check the warning message from your browser and/or enable Java applets in<br
/>
your web browser preferences, or install the Java Runtime Environment from
<a href='http://www.java.com'>www.java.com</a><br /></p></object>
The following should work with Firefox, though I think now with MSIE:
http://chemapps.stolaf.edu/jmol/docs/examples-11/t.xhtml
If you have both the inline SVG and the applet you should see an applet with
1crn.pdb in it along with a cool shaded yellow-green background.
(It works locally for me with MSIE, just not when on my server, so I suspect
it's just a server issue.)
Bob
On Wed, May 6, 2009 at 6:33 PM, Jeff Hansen <jhan...@depauw.edu> wrote:
> Angel,
>
> Thanks for looking into this. What you are seeing is basically what
> I've been seeing. I validated my page as you suggested (had to fix a
> few things). It gives no errors for xhtml strict. In Firefox the
> page "loads" and Firebug does not indicate any errors but the page is
> blank. In Safari 4 the page is blank but the error console indicates
> two errors. The first is a SyntaxError: Parse Error. The second is
> the TypeError: Result of expression
> '_jmol.currentDocument.write' [undefined] is not a function (basically
> what you saw).
>
> So what it sounds like will be required is maybe a rewrite of jmol.js
> that uses some DOM based alternative to document.write. Sounds like a
> challenge. Should be a good learning experience.
>
>
> ***********************************************
> Jeff Hansen
> Department of Chemistry and Biochemistry
> DePauw University
> 602 S. College Ave.
> Greencastle, IN 46135
> jhan...@depauw.edu
> ***********************************************
>
>
> On May 6, 2009, at 7:03 PM, Angel Herráez wrote:
>
> > It seems that the first hit is caused by document.write not being
> > supported
> > by XHTML (documented in several websites)
> >
> > My test:
> > XHTML 1.0 Transitional
> >
> > _jmol.currentDocument.write(text);
> > at line line 834 within
> > function _jmolDocumentWrite(text) {
> >
> > throws an error in Firefox 3
> > No error in Opera, but no applet
> >
> > Clue:
> > Does document.write work in XHTML?
> > No. Because of the way XML is defined, it is not possible to do
> > tricks like
> > this, where markup is generated by scripting while the parser is
> > still parsing
> > the markup.
> > You can still achieve the same effects, but you have to do it by
> > using the
> > DOM to add and delete elements.
> > (source: http://www.w3.org/MarkUp/2004/xhtml-faq#docwrite)
> >
> >
> > And quoting
> > http://jmol.sourceforge.net/docs/JmolAppletGuide.html#XHTMLSupport
> >
> > the standard Jmol.js Javascript library will not work under properly
> > compliant XML browsers. An alternative, largely similar, but entirely
> > unsupported library is available ... insert address here ...
> > (that JmolAppletGuide doc is old --Miguel's times? ... but true
> > indeed)
> >
> >
> > I've tested the alternative to document.write given at
> > http://weston.ruter.net/projects/xhtml-document-write/
> > http://shepherd-interactive.googlecode.com/svn/trunk/xhtml-document-
> > write/xhtml-document-write.js
> >
> > and, althogh it does not solve the problem, is on its way:
> >
> > Opera displays a functional applet, but below it is the yellow box
> > that says
> > "you don't have Java" (generated by Jmol.js)
> >
> > Firefox displays a Java box with an error, applet class not found,
> > and the
> > yellow box below it
> >
> > IE8 displays nothing --seems not to like xhtml at all --even with no
> > Jmol
> > code in the page, it just displays a blank page and does a download
> > --of the
> > page?.
> >
> >
> > More to come...
> >
> >
> >
> >
> ------------------------------------------------------------------------------
> > The NEW KODAK i700 Series Scanners deliver under ANY circumstances!
> > Your
> > production scanning environment may not be a perfect world - but
> > thanks to
> > Kodak, there's a perfect scanner to get the job done! With the NEW
> > KODAK i700
> > Series Scanner you'll get full speed at 300 dpi even with all image
> > processing features enabled. http://p.sf.net/sfu/kodak-com
> > _______________________________________________
> > Jmol-users mailing list
> > Jmol-users@lists.sourceforge.net
> > https://lists.sourceforge.net/lists/listinfo/jmol-users
>
>
>
> ------------------------------------------------------------------------------
> The NEW KODAK i700 Series Scanners deliver under ANY circumstances! Your
> production scanning environment may not be a perfect world - but thanks to
> Kodak, there's a perfect scanner to get the job done! With the NEW KODAK
> i700
> Series Scanner you'll get full speed at 300 dpi even with all image
> processing features enabled. http://p.sf.net/sfu/kodak-com
> _______________________________________________
> Jmol-users mailing list
> Jmol-users@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/jmol-users
>
--
Robert M. Hanson
Professor of Chemistry
St. Olaf College
1520 St. Olaf Ave.
Northfield, MN 55057
http://www.stolaf.edu/people/hansonr
phone: 507-786-3107
If nature does not answer first what we want,
it is better to take what answer we get.
-- Josiah Willard Gibbs, Lecture XXX, Monday, February 5, 1900
------------------------------------------------------------------------------
The NEW KODAK i700 Series Scanners deliver under ANY circumstances! Your
production scanning environment may not be a perfect world - but thanks to
Kodak, there's a perfect scanner to get the job done! With the NEW KODAK i700
Series Scanner you'll get full speed at 300 dpi even with all image
processing features enabled. http://p.sf.net/sfu/kodak-com
_______________________________________________
Jmol-users mailing list
Jmol-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/jmol-users