Well, what do you know. The problem with MSIE was a Jmol bug. Ahem. When 
the new window applet was being created, it called for a 
messageCallback, because that was part of the original applet on that 
page. Since the function named was not found during the callback, and 
since we had not considered that error, MSIE properly generated an 
exception that stopped the applet. If anything, it is a Mozilla bug in 
not properly notifying the applet that a JavaScript call failed.

I have checked in a bug fix as 11.1.20 and also put that code up in
 http://www.stolaf.edu/academics/chemapps/jmol/docs/examples-11 
<http://www.stolaf.edu/academics/chemapps/jmol/docs/examples-11/new.htm>

Here is the final newAppletWindow() function as I have it working in 
MSIE 6. Please to try this with IE 7 at 
http://www.stolaf.edu/academics/chemapps/jmol/docs/examples-11/new.htm 
by clicking on that new-window link under the applet. I've modified the 
warning in Jmol.js to better explain what the problem is when MSIE 
blocks an applet.

function newAppletWindow() {
 jmolSetDocument(0)
var script = ';set echo middle center; echo Click on "refresh model" at 
any time|to see the model in its current state in this window.||You may 
refresh the model as often as desired,|and you may resize this model as 
often as you like.'
 var html = '<html><title>Jmol Popup Model</title><body>'
    +'<h3><a 
href="javascript:document.getElementById(\'jmolAppletX\').script(opener.jmolGetPropertyAsString(\'stateInfo\')+\';zoomLarge
 
= false\')">refresh model</a></h3>'
    
+jmolApplet(["100%","90%"],script,"X").replace(/allback/g,"allbackDISABLED")
    +'</body></html>'
dowritenew(html)
}

Notable about this function:

--Jmol.js is NOT included here, because that causes Firefox to not close 
the document properly. This is a Firefox bug.

--jmolSetDocument(0) is used to get the HTML code of the new applet, not 
a write to the page.

--in the jmolApplet command:

jmolApplet(["100%","90%"],script,"X").replace(/allback/g,"allbackDISABLED")

(1) I'm using 90% for the height because I have the <H3> link above the 
applet, and this takes some vertical space.
(2) an explicit applet suffix "X" is used so we can reference the applet 
as "jmolAppletX" in our "refresh model" link.
(3) we hack the jmolApplet() output to disable any parameter that looks 
like "callback".

--the "refresh model" link href is quite interesting:

document.getElementById('jmolAppletX')
    .script(opener.jmolGetPropertyAsString('stateInfo')+';zoomLarge = 
false')

OK:

(1) we don't have Jmol.js in this new window, so we can't use 
"jmolScript". Instead, we find the applet object ourselves using 
document.getElementById() and use the applet's .script() method directly.

(2) consider what the following does:

   ...script(opener.jmolGetPropertyAsString('stateInfo')+';zoomLarge = 
false')

It goes to the ORIGINAL page, gets the state of the OTHER applet, sets 
the automatic zoom to be based on the smaller dimension, not the larger 
one [I hate this, sorry Miguel!], and then applies that state to THIS 
applet. Instant model copy!

What this means is that you can click the link at any time and get an 
updated resizable model in that popup window.

How cool can that be?

As people start using this, they will find bugs in the state 
save/restore business. Please let me know all that you find. I just 
found one myself relating to rotateSelected and spinning. For more 
complex examples, such as several isosurfaces or the latest in variables 
and data, there could be additional problems. I guarantee nothing!

Bob



-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys-and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
Jmol-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/jmol-users

Reply via email to