是否可以使用javascript查找文件的上次修改时间? [英] Is it possible with javascript to find file's last modified time?

查看:126
本文介绍了是否可以使用javascript查找文件的上次修改时间?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有可能吗?现在,我已经进行了实时聊天,在jquery的帮助下,我连接到.php文件并检查上次修改时间,如果不是以前,我检索消息。如果有可能在javascript中我可能会节省大量资源。

Is it possible? Now, I have done live chat, where with jquery's help I connect to .php file and check last modified time and if it is not as before, I retrieve messages. If it were possible in javascript I probably would save a lot of resources.

谢谢。

推荐答案

简短回答:除了AJAX +服务器端脚本(在你的情况下,jQuery + php)没有办法

Short answer: there's no way but AJAX + a server-side script (in your case, jQuery + php)

作为客户端脚本,javascript在客户端的计算机上运行,​​因此如果要检查m-time的文件在服务器上,那么使用AJAX和服务器端脚本是正确的。没有其他方法可行。

Being a client-side script, javascript gets run on the client's computer, so if the file whose m-time you want to check is on the server, then you are correct to use AJAX and a server-side script. No other way will work.

如果要检查m时间的文件在客户端的计算机上,那么你运气不好。故意设计Javascript以防止访问客户端的文件。 (它只能访问客户端计算机上 的cookie,但是,因为浏览器(不是任何javascript)将这些加载到其工作环境中。)

If the file whose m-time you want to check is on the client's computer, then you're out of luck. Javascript is intentionally designed to be prevented from accessing the client's files. (It can only access cookies, which are on the client's computer, however, because the browser (not any javascript) loads those into its work environment.)

这篇关于是否可以使用javascript查找文件的上次修改时间?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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