如何检查我的c:\ abc \ abc.js上的.js文件是否已加载? [英] How can check whether a .js file located on my c:\abc\abc.js is loaded?

查看:102
本文介绍了如何检查我的c:\ abc \ abc.js上的.js文件是否已加载?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

您好,





我有一个网页,我在其中引用了存储在c:\中的本地.js文件abc \abc.js。



如何判断文件是否存在?



我不能在我的项目中使用JQuery,那么有没有正常的java脚本方法来确定这个?



祝你好运,

Prasanth.k

Hello,


I have a webpage where i have referred a local .js file which is stored in c:\abc\abc.js.

How can i determine whether the file exists or not?

I cant use JQuery in my project, So is there any normal java script way to determine this?

Best regards,
Prasanth.k

推荐答案

如果您通过HTTP服务器,这是在服务器端,没办法。



您无法使用具有此类位置的文件。您根本不能使用绝对路径名。 Web应用程序在沙盒环境中执行,不允许您访问站点根目录之外的任何文件。



即使你没有''使用任何服务器并只开发一组HTML / JavaScript文件(如文档),使用绝对路径是没有用的。远离麻烦。



-SA
If you work through the HTTP server, this is on the server side, no way.

You cannot use the file with such location. You cannot use absolute path names at all. A Web application is executed in sandboxed environment which won''t allow you to access any files beyond the root directory of your site.

And even if you don''t use any server and develop just a collection of HTML/JavaScript files (such as documentation), using of absolute paths just cannot be useful. Stay out of trouble.

—SA


这篇关于如何检查我的c:\ abc \ abc.js上的.js文件是否已加载?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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