2009/3/2 Richard Quadling <rquadl...@googlemail.com>:
> 2009/3/2 zero <zero.zero1...@gmail.com>:
>>
>> On page that iframe load u can put code:
>> <script type="text/javascript">
>>                parent.name_of_some_js_function();
>> </script>
>> Works for me in all browsers.
>>
>> On 2 Mar, 14:21, Richard Quadling <rquadl...@googlemail.com> wrote:
>>> Hi.
>>>
>>> I'm currently using an iframe to act as a report downloader.
>>>
>>> The user enters some criteria which is generated dynamically as they
>>> change options. They then click a document button (PDF, XLS, DOC) and
>>> this is sent to the server for validation. The result is a key for the
>>> Crystal Reports. The JS code generates an iframe and passes the key as
>>> part of the URL. As the key is a hash, and has to be part of the
>>> user's session, security is quite high. Guessing keys is useless
>>> unless there is corresponding data already submitted for the key.
>>>
>>> On screen, I dim the form for ajax requests and fade in a spinner.
>>>
>>> So far so good.
>>>
>>> My problem is that once I've created the iframe I've no way of knowing
>>> about the state of the iframe - has it loaded and presented the user
>>> with the appropriate download box.
>>>
>>> Are there any events I can observe with regard to an iframe (ie7, FF,
>>> Chrome - intranet only and so can be limited in support).
>>>
>>> I suppose as a side question, how do I find what events are observable
>>> for any element? Is there a way? Or is it just a case of RTF HTML/JS M
>>>
>>> Regards,
>>>
>>> Richard Quadling.
>>>
>>> --
>>> -----
>>> Richard Quadling
>>> Zend Certified Engineer :http://zend.com/zce.php?c=ZEND002498&r=213474731
>>> "Standing on the shoulders of some very clever giants!"
>> >>
>>
>
> Hmm..
>
> Currently, the iframe has no HTML/CSS/JS content as the server simply
> supplies a download which causes the browser to ask to save. I'm using
> PHP and here is the key part.
>
> // Generate file and then supply headers along with the data.
> header("{$_SERVER['SERVER_PROTOCOL']} 200 OK", True, 200);
> header('Content-Description: File Transfer');
> header("Content-Type:
> {$_SESSION['Reports'][$_GET['Hash']]['ExportInfo']['Mime']}");
> header('Content-Disposition: attachment; filename="' .
> $_SESSION['Reports'][$_GET['Hash']]['Report']['ExternalName'] . '.' .
> $_SESSION['Reports'][$_GET['Hash']]['ExportInfo']['Extension'] . '"');
> header('Content-Transfer-Encoding: binary');
> header('Expires: 0');
> header('Cache-Control: must-revalidate, post-check=0, pre-check=0');
> header('Pragma: public');
> header('Content-Length: ' . filesize($s_ExportedReport));
> readfile($s_ExportedReport);
> unlink($s_ExportedReport);
>
> So, I can't add HTML/CSS/JS to the frame AND have the download happen.
>
> I found I can observe the "load" event on the iframe, but only in
> FireFox. It seems that nothing is fired for IE/Chrome at all. Also
> tried dom:loaded - nothing in any of the browsers.
>
> I think the above code would need to be amended to do something like this ...
>
> Generate the report and save it with a unique name.
> Generate the iframe's HTML so that it includes the JS to tell the
> parent all is well and a location.refresh to point to a script to
> supply the newly generated file.
>
> Seems convoluted, but then again, downloading with no refresh SEEMS
> convoluted anyway.
>
> And as I'm typing this, Alex has just replied ... reading.
>
> Ah. Yes. If the iframe had content, then I could traverse it quite happily.
>
> Breaking the generation and the downloading seems to be the next obvious way.
>
> Any other POVs?
>
> Richard.
>
>
> --
> -----
> Richard Quadling
> Zend Certified Engineer : http://zend.com/zce.php?c=ZEND002498&r=213474731
> "Standing on the shoulders of some very clever giants!"
>

Or duh ...

http://particletree.com/notebook/ajax-file-download-or-not/

Is this right?

A straight form with a download link (i.e. form's response will be
downloadable file?) Just triggered using JS?

Hmm.. Of course that will work,but I still don't know when the form is ready.

So maybe a form event to know it has finished processing would be a
better/easier solution ... looking into it ...

-- 
-----
Richard Quadling
Zend Certified Engineer : http://zend.com/zce.php?c=ZEND002498&r=213474731
"Standing on the shoulders of some very clever giants!"

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Prototype & script.aculo.us" group.
To post to this group, send email to prototype-scriptaculous@googlegroups.com
To unsubscribe from this group, send email to 
prototype-scriptaculous+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/prototype-scriptaculous?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to