|
Hello Forum,
I have a question regarding bringing a 'save as' prompt for XML files (instead of opening the file in a browser as browser interprets the XML format).
My 'download.html' has a hyperlink to the xml file. 'On Click' ing this hyperlink a new window is supposed to open up with the 'save as' prompt, as I want my parent html page to be still in place for more downloads.
Here is JS and html code I am using:
<script language="JavaScript" type="text/JavaScript">
function openDownLoadPrompt(URL){
var window1=window.open(URL,'mywindow','width=600,height=500,screenX=0,screenY=0,left=0,top=0,toolbar=yes,location=yes,directories=yes,status=yes,menubar=yes,scrollbars=yes,copyhistory=yes,resizable=yes');
window1.document.execCommand("SaveAs","1","");
}
</script>
<a href="#" onClick=openDownLoadPrompt("/forum/sample.xml")>
Download XML </a>
The problem I am having is a 'save as' option is shown in the new window before the XML loads, and if I save it a blank document is saved.
I really appreciate it if any one can suggest me how to let the XML document load before I use 'execCommand', or any other alternative way of achieving the same would also be great.
Thanks to you all in advance.
Phani
|
|
|
|
|
|
|
|