Click here to Skip to main content
15,896,522 members
Please Sign up or sign in to vote.
1.00/5 (2 votes)
See more:
Hi everyone


This is what i tried:

I had placed the doc in the server C drive and i am trying to access it though the file://servername/foldername/documentname.

JavaScript
<script>
function myFunction() {
   window.open(file://servername/Demo.html);
}"
</script>

Can u Please help On how to achive the same.

Or is there any alternative to get it
Posted
Updated 22-Mar-15 20:21pm
v2

1 solution

It makes little to no sense. If this is the client-side JavaScript embedded in the browser (most usual situation), JavaScript cannot access any files; you can only send some HTTP request to the server, but it's up the the server part to access the file and possibly return its content in HTTP response. I doubt it happens, first of all, because of the location of the file. Even the server-side code cannot access all files on the server's host file systems; typically, Web applications are executed in the sandboxed environment only providing access to file system objects under the root directory set up for the site.

If you are doing something unrelated to more or less typical Web technologies, you have to explain it.

—SA
 
Share this answer
 
Comments
Member 11546698 23-Mar-15 3:04am    
Hi,
Thanksyou for your quick response.
Actually that was the intial phase i went through.You are right on the part that java script cannnot make server calls.I sent a http request also but i couldn't access it.I digged in deep and now I am trying to access the same document(.mhtml) located on my server C drive through Active X objects
.I am New to scripting,so may be some guidance will help
If you can help me that if i going to the right path and how to do it
Sergey Alexandrovich Kryukov 23-Mar-15 3:23am    
(Sight...) First, there is no such thing as "java script" — Java is not a scripting language. ;-)

No, I did not say the JavaScript (is that what you meant) cannot make server calls. I said that it can. If you don't know that, I'll tell you: through AJAX. But this is probably irrelevant.

ActiveX object, just the opposite, can access local system and cannot do anything to the server side. And you should not use ActiveX. The reason is too obvious to discuss, you can read a lot of discussion of this topic.

You need no guidance on the topic except my answer. You cannot do such things at all. There is no "right pass". Just forget it. And I believe you don't need it, it makes no sense.

Try to understand it all, accept my answer formally (because this is really the end of the story), and get to some more useful activity — this is all I can advise.

—SA
Member 11546698 23-Mar-15 4:00am    
Hi,
Thank you for your valuable time.My question may make a little sense because i m new to coding i am trying to dig and work out.
I just need to open a file on my server though a code.
Thank you so much for your time.
Sergey Alexandrovich Kryukov 23-Mar-15 4:04am    
You only can do it 1) in server-side code, perhaps on behalf of client-side script or anything else on client side; 2) this file should be the file under the site's root directory, never anything else.
What server-side technology you are using, if any? need any help with the above?
-SA
Member 11546698 23-Mar-15 4:59am    
No specific technology i am following.
I think it can be done by -server side(may be jsp) or Asp(but i m rstricted not to use one as i actually want to integrate the code script with Ms Crm 2013 buttons(Action on one of the Button).
Please guide me with the best solution possible

Thanks in advance.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900