Monday, February 26, 2024
164
rated 0 times [  170] [ 6]  / answers: 1 / hits: 19414  / 13 Years ago, mon, april 4, 2011, 12:00:00

I am looking out for a way to open a .xls file which is in temp directory using javascript in IE and Firefox browser. I tried using the javascript as follows,



function openMe(){
var newwindow=window.open(file:///{path to temp dir}/names.xls,window2,);
}


The names.xls file exists there, I have verified it. As IE 7.0 does not let a user open a blank window due to security issues I am unable to make this work. I have not checked it with firefox yet. Is there any way to get this working?



I also tried having an empty.html which has this javascript and calling this openMe() body onLoad. And opening the empty.html from the parent HTML file. All I see is a new blank window without nothing but the file does not open.



Any pointers would be greatly helpful.Thanks



Cheers,
Abi


More From » internet-explorer

 Answers
24

Sorry, Abi, you're out of luck--you can't use JavaScript in a browser to open a file on the local file system. This is a security issue and makes perfect sense if you think about it; you wouldn't want people writing scripts on their web sites that can access files on your local file system and possibly read data from them!


[#92922] Saturday, April 2, 2011, 13 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
maxinec

Total Points: 117
Total Questions: 116
Total Answers: 116

Location: Bangladesh
Member since Sat, Jan 23, 2021
3 Years ago
maxinec questions
;