[英]Can I list a directory with just Javascript/JQuery?
I would like to list the directory that my current website will be in as a browsable tree (similar to the way a web browser lists a directory if there are no index files present) - basically, an FTP listing. 我想将我当前网站所在的目录以可浏览的树的形式列出(类似于如果没有索引文件,Web浏览器列出目录的方式)-基本上是FTP清单。 However, I can't use PHP because the server I'm developing for does not support PHP (or any similar tools as far as I'm aware).
但是,我不能使用PHP,因为我正在开发的服务器不支持PHP(据我所知,它不支持任何类似的工具)。 I do have access to JQuery, and Java and Flash applets, though.
我确实可以访问JQuery以及Java和Flash小程序。
My question is, first of all, is that even possible? 我的问题是,首先有可能吗? I know I can make a link that will make the browser list the directory for me, but I want this embedded within my own website (ie inside a div).
我知道我可以创建一个链接,该链接将使浏览器为我列出目录,但是我希望将此链接嵌入我自己的网站中(即div中)。 I would prefer doing it all with just JQuery/Javascript.
我宁愿仅使用JQuery / Javascript来完成所有操作。 I'm also fairy fluent in Java, but I don't know if I can list directories in an unsigned applet.
我也精通Java,但是我不知道是否可以在未签名的applet中列出目录。
If your server is set to list directories, you can send an XHR for the directory you want and parse the returned HTML. 如果服务器设置为列出目录,则可以发送所需目录的XHR并解析返回的HTML。 However, you'd be better off providing a web service that lists directories for you.
但是,最好提供一种为您列出目录的Web服务。
I don't understand your problem completely, I see only one possible solution without a server side language. 我无法完全理解您的问题,没有服务器端语言,我只能看到一种可能的解决方案。
Include tree like structure for all directory components(path) links (native htmls) in index.html and apply some basic jquery animation to feel like tree structure. 在index.html中为所有目录组件(路径)链接(本机html)包括树状结构,并应用一些基本的jquery动画来感觉像树状结构。
Jquery / javascript are client side languages, you must have something on your server. jQuery / javascript是客户端语言,您的服务器上必须有内容。
Perhaps if you'll have a WebService on your server, you can call it with jquery and format it in your html. 也许如果您的服务器上有WebService,则可以使用jquery对其进行调用并将其格式化为html。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.