简体   繁体   English

我可以只用Javascript / JQuery列出目录吗?

[英]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.

相关问题 ? 如何在不使用 stream 的情况下列出目录或驱动器中的所有文件并仅使用 java 中的 nio api 按创建日期对其进行排序 - ? How can I list all files in directory or drive without using stream and sort it by creation date using just nio api in java 只需在Jetty中指定目录URL,即可提供目录中文件的列表 - Serve a list of files in a directory by just specifying the directory URL in Jetty 如何设置Intellij复制资源目录,而不仅仅是目录内容? - How can I set Intellij to copy resource directories and not just the directory content? 我如何在JavaScript中执行操作就像在Java流中进行操作管道一样? - How can I perform operations in JavaScript just like we do pipeline of operations in Java streams? 如何将只有一个值的列表传递给另一个更简洁的方法 - How can I make passing a list with just one value to an other method less verbose 为什么我不能只让node = node.next遍历链表? - Why can't I just do node = node.next to iterate through linked list? 如何使用 subList() 或任何其他方法获取 java.util.List 中的最后一条记录? - How can I just get the last record in the java.util.List using subList() or any other method? 如何在 javascript jquery 和 java Z2A2D595E6ED9A0B24D0ZB143 - how can I set the post path in javascript jquery with java spring 我如何理解edittext中的javascript或jquery代码? - How can I understand javascript or jquery code inside in edittext? 如何实现用于列表的ListMode显示目录中的所有文件? - How can i implement ListMode to use for my list show all file in directory?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM