I think when you set window.location you are effectively overwriting the
page.


The write command works by sending the data to a server and having it be
reflected back to the user.


On Sun, Jan 26, 2014 at 5:20 PM, Roberto Mosca <robmo...@gmail.com> wrote:

> The download button that I press downloads a different file with respect
> to the one that is loaded in the JSmol applet.
>
> In any case, my question is why the applet stops working after I set
> window.location to a different URL, in case you know it.
>
> On the other hand, I thought Javascript is not allowed to save a file in
> filesystem of the client. How can the write command work?
>
> Best,
> Roberto
>
> On 24 Jan 2014, at 23:01, Robert Hanson <hans...@stolaf.edu> wrote:
>
> Where is the need for window.open() or window.location coming from in the
> first place? Jmol has a WRITE command that would let you do that, I think.
> Why not just use
>
> write file "xxx.pdb"
>
> That's much cleaner.
>
>
>
>
>
> On Fri, Jan 24, 2014 at 12:13 PM, Roberto Mosca <robmo...@gmail.com>wrote:
>
>> Ok, sorry, I could fix the problem by using window.open() instead of
>> setting window.location.
>>
>> In any case, anyone can help me in understanding what happens?
>>
>> Thanks in advance! :)
>>
>> Roberto
>>
>>
>> On Fri, Jan 24, 2014 at 6:01 PM, Roberto Mosca <robmo...@gmail.com>wrote:
>>
>>> Dear all,
>>>
>>> I am experiencing a strange problem with JSmol. I have a JSmol applet on
>>> my page and a link to download the PDB file.
>>>
>>> The link works by setting "window.location" to a php page that forces
>>> the download of the PDB file (via headers like "Content-Disposition:
>>> attachment; filename=...") without actually leaving the papge where the
>>> Jmol applet is.
>>>
>>> The problem is that the Jmol applet works perfectly before I click on
>>> the link, and when I click there the browser dowloads the file but then the
>>> Jmol applet freezes.
>>>
>>> I had a look at the Javascript console and it turns out that if I try to
>>> do anything with Jmol after clicking on the link to download the PDB file I
>>> get a long list of errors:
>>>
>>>
>>> Uncaught TypeError: Cannot read property 'viewer' of null
>>> JSmol.min.nojq.js:80
>>> g._processEvent JSmol.min.nojq.js:80
>>> (anonymous function) JSmol.min.nojq.js:55
>>> p.event.special.(anonymous function).handle jquery-1.8.2.min.js:2
>>> p.event.dispatch jquery-1.8.2.min.js:2
>>> g.handle.h
>>>
>>>
>>> Any ides of why it is so? Am I doing something wrong?
>>>
>>> Let me know.
>>>
>>> Best,
>>> Roberto
>>>
>>> Roberto Mosca, Ph.D.
>>>
>>> Structural Bioinformatics and Network Biology
>>> Institute for Research in Biomedicine (IRB Barcelona)
>>> Parc Científic de Barcelona
>>> C/ Baldiri Reixac 10
>>> 08028 Barcelona - Spain
>>>
>>> Email: roberto.mo...@irbbarcelona.org
>>> Tel:   +34 93 40 39689
>>> Web:   http://sbnb.irbbarcelona.org/people/roberto_mosca
>>>
>>
>>
>>
>> --
>> La chiocciol@
>> http://lachiocciola.tumblr.com/
>>
>>
>> ------------------------------------------------------------------------------
>> CenturyLink Cloud: The Leader in Enterprise Cloud Services.
>> Learn Why More Businesses Are Choosing CenturyLink Cloud For
>> Critical Workloads, Development Environments & Everything In Between.
>> Get a Quote or Start a Free Trial Today.
>>
>> http://pubads.g.doubleclick.net/gampad/clk?id=119420431&iu=/4140/ostg.clktrk
>> _______________________________________________
>> Jmol-users mailing list
>> Jmol-users@lists.sourceforge.net
>> https://lists.sourceforge.net/lists/listinfo/jmol-users
>>
>>
>
>
> --
> Robert M. Hanson
> Larson-Anderson Professor of Chemistry
> St. Olaf College
> Northfield, MN
> http://www.stolaf.edu/people/hansonr
>
>
> 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
>
> ------------------------------------------------------------------------------
> CenturyLink Cloud: The Leader in Enterprise Cloud Services.
> Learn Why More Businesses Are Choosing CenturyLink Cloud For
> Critical Workloads, Development Environments & Everything In Between.
> Get a Quote or Start a Free Trial Today.
>
> http://pubads.g.doubleclick.net/gampad/clk?id=119420431&iu=/4140/ostg.clktrk_______________________________________________
> Jmol-users mailing list
> Jmol-users@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/jmol-users
>
>
>
>
> ------------------------------------------------------------------------------
> CenturyLink Cloud: The Leader in Enterprise Cloud Services.
> Learn Why More Businesses Are Choosing CenturyLink Cloud For
> Critical Workloads, Development Environments & Everything In Between.
> Get a Quote or Start a Free Trial Today.
>
> http://pubads.g.doubleclick.net/gampad/clk?id=119420431&iu=/4140/ostg.clktrk
> _______________________________________________
> Jmol-users mailing list
> Jmol-users@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/jmol-users
>
>


-- 
Robert M. Hanson
Larson-Anderson Professor of Chemistry
St. Olaf College
Northfield, MN
http://www.stolaf.edu/people/hansonr


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
------------------------------------------------------------------------------
CenturyLink Cloud: The Leader in Enterprise Cloud Services.
Learn Why More Businesses Are Choosing CenturyLink Cloud For
Critical Workloads, Development Environments & Everything In Between.
Get a Quote or Start a Free Trial Today. 
http://pubads.g.doubleclick.net/gampad/clk?id=119420431&iu=/4140/ostg.clktrk
_______________________________________________
Jmol-users mailing list
Jmol-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/jmol-users

Reply via email to