使用javascript代码在netwrok(服务器)上打开页面 [英] Opening a page on a netwrok(a server) using javascript code

查看:74
本文介绍了使用javascript代码在netwrok(服务器)上打开页面的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好





这就是我的尝试:



我已将文档放在服务器C驱动器中,我试图通过文件访问它:// servername / foldername / documentname。



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.

<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

推荐答案

它几乎没有任何意义如果这是浏览器中嵌入的客户端JavaScript(最常见的情况),JavaScript无法访问任何文件;您只能向服务器发送一些HTTP请求,但它是访问该文件的服务器部分并可能返回它在HTTP响应中的内容。我怀疑它是否发生,首先是因为文件的位置。甚至服务器端代码也无法访问服务器主机文件系统上的所有文件;通常,Web应用程序在s中执行andboxed环境只提供对为站点设置的根目录下的文件系统对象的访问。



如果你正在做一些与或多或少典型的Web技术无关的事情,你必须解释一下。



-SA
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


这篇关于使用javascript代码在netwrok(服务器)上打开页面的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆