Bob,
I do it with explicit links that leave the page, but it should work with
onbeforeunload to automate it. The return is taken care of in the app (model
kit). The return to model kit is handled in the Jmol ready callback. If the
special memory location is not null, then the memory data is loaded. That's why
removing this data as soon as you grab it is important.
When I was trying to do this with post state to my server for cross computer
model sharing, you gave me some advice on possible problem characters. I just
got frustrated with Windows, which can be very fussy. Currently for sharing
models cross-computer, I save molfiles to server. I need to go back and look at
the use of state.
I understand the problems with large molecules. I was basically throwing this
out there for small molecule application users.
Otis
--
Otis Rothenberger
o...@chemagic.com
http://chemagic.com
> On Feb 13, 2016, at 11:58 AM, Robert Hanson <hans...@stolaf.edu> wrote:
>
> nice. Yes, saving the state would be more general:
> Jmol.getPropertyAsString("stateInfo")
>
> Otis, what events exactly are you using for triggering the save and restore
> scripts?cit
>
>> var stash = localStorage.getItem("chemagicTEMP”);
>> if (stash == null || stash == undefined || stash == "") { stash = ""; } //
>> Overkill, I’m a bit retentive...
>
> A simpler, more concise, coding of this might be:
>
> var stash = localStorage.getItem("chemagicTEMP”) || "";
>
>
> Since the state is a script, you do not need the MODS thing:
>
> function saveState() {
> localStorage.setItem("JSmolState",
> Jmol.getPropertyAsString(jmolApplet0, "stateInfo"));
> }
>
> function restoreState() {
> var state = localStorage.removeItem("JSmolState") || "";
> if (state.indexOf("# Jmol state") >= 0)
> Jmol.script(jmolApplet0, state);
>
> }
>
> But I think, actually, there are some very serious additional issues that
> might prevent this from being a general method. Specifically, when some file
> types are loaded, such as PDB files in gzip format, they are inserted into
> JSmol's own cache, which is a binary array cache, not a string. When the
> state is saved, the reference to this file is not the original call, but
> instead a call to the local JSmol cache. But when this localStorage business
> is implemented, then all you can save are strings, not binary arrays. So the
> script fails.
>
> Bob
>
> ------------------------------------------------------------------------------
> Site24x7 APM Insight: Get Deep Visibility into Application Performance
> APM + Mobile APM + RUM: Monitor 3 App instances at just $35/Month
> Monitor end-to-end web transactions and take corrective actions now
> Troubleshoot faster and improve end-user experience. Signup Now!
> http://pubads.g.doubleclick.net/gampad/clk?id=272487151&iu=/4140
> _______________________________________________
> Jmol-users mailing list
> Jmol-users@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/jmol-users
------------------------------------------------------------------------------
Site24x7 APM Insight: Get Deep Visibility into Application Performance
APM + Mobile APM + RUM: Monitor 3 App instances at just $35/Month
Monitor end-to-end web transactions and take corrective actions now
Troubleshoot faster and improve end-user experience. Signup Now!
http://pubads.g.doubleclick.net/gampad/clk?id=272487151&iu=/4140
_______________________________________________
Jmol-users mailing list
Jmol-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/jmol-users