热门标签 | HotTags
当前位置:  开发笔记 > 编程语言 > 正文

创建一个Javascript本地应用程序(在浏览器中运行)?-CreatingaJavascriptlocalapplication(raninbrowser)?

IdliketowriteanapplicationthatwouldusebothJavascriptandHTMLasfortheuserinterface.

I'd like to write an application that would use both Javascript and HTML as for the user interface. The app wouldn't really need an internet connection but will need access to the user's local files.

我想编写一个将Javascript和HTML用作用户界面的应用程序。该应用程序不需要互联网连接,但需要访问用户的本地文件。

My first thought was that this would be impossible in a browser due to the security restrictions on the access to local files.

我的第一个想法是,由于访问本地文件的安全限制,这在浏览器中是不可能的。

My second thought was to try to use webkit directly from C++ and use Python instead of Javascript, but that seems rather complicated, and I feel like overkilling by using Qt.

我的第二个想法是尝试直接从C ++使用webkit并使用Python而不是Javascript,但这似乎相当复杂,我觉得使用Qt过度使用。

My third thought was to use a signed Java applet to make all local accesses, but then I'm not too sure of this either.

我的第三个想法是使用一个签名的Java小程序来进行所有本地访问,但是我对此也不太确定。

Any suggestions on what I should do?

关于我应该做什么的任何建议?

7 个解决方案

#1


6  

I'll admit that I know very little about this, but it sounds like what you're after is what XUL provides.

我承认我对此知之甚少,但这听起来像你所追求的是XUL所提供的。

From the homepage:

从主页:

XUL (XML User Interface Language) is Mozilla's XML-based language that lets you build feature-rich cross platform applications that can run connected or disconnected from the Internet.

XUL(XML用户界面语言)是Mozilla基于XML的语言,它允许您构建功能丰富的跨平台应用程序,这些应用程序可以与Internet连接或断开连接。

...

Web developers already familiar with Dynamic HTML (DHTML) will learn XUL quickly and can start building applications right away.

熟悉动态HTML(DHTML)的Web开发人员将快速学习XUL并立即开始构建应用程序。

Regarding filesystem access: https://developer.mozilla.org/en/Code_snippets/File_I//O

关于文件系统访问:https://developer.mozilla.org/en/Code_snippets/File_I//O

This article describes local file input/output in chrome Javascript.

本文介绍了chrome Javascript中的本地文件输入/输出。

You access the file system using Mozilla XPCOM components. A list of resources and interfaces for local I/O is available for both Files and Streams at XUL Planet.

您可以使用Mozilla XPCOM组件访问文件系统。 XUL Planet的文件和流均可使用本地I / O的资源和接口列表。

Because of my lack of familiarity, I'll leave it up to the community to decide whether or not this answer has merit.

由于我不熟悉,我会让社区决定这个答案是否有价值。

EDIT: Making this answer a community wiki since I don't have much real information to offer.

编辑:将此答案作为社区维基,因为我没有太多可用的真实信息。

#2


2  

It seems, 5 years after the question was asked, there is a framework to do exactly this: build cross platform desktop app with Javascript, HTML, and CSS, and with access to local files, http://electron.atom.io/.

问题被提出5年后,似乎有一个框架可以做到这一点:使用Javascript,HTML和CSS构建跨平台桌面应用程序,并访问本地文件,http://electron.atom.io/ 。

I have not used it myself, but it is recommended in other answers.

我自己没有使用它,但在其他答案中建议使用它。

#3


1  

You can always install needed servers locally and access user's local files that way.

您始终可以在本地安装所需的服务器,并以此方式访问用户的本地文件。

I have been using Server2Go and MAMP

我一直在使用Server2Go和MAMP

#4


1  

You could - for example - use Cappuccino: It allows you to build Applications in Objective-J (a language written in Javascript) and run them either in the browser or as a Desktop application with local file access .

您可以 - 例如 - 使用Cappuccino:它允许您使用Objective-J(一种用Javascript编写的语言)构建应用程序,并在浏览器中或作为具有本地文件访问权限的桌面应用程序运行它们。

Then there is Adobe AIR, which allows you to write apps in Javascript/HTML and access the file system.

然后是Adobe AIR,它允许您使用Javascript / HTML编写应用程序并访问文件系统。

Or you could use the new File Access API: http://hacks.mozilla.org/2009/12/w3c-fileapi-in-firefox-3-6/ (it has big restrictions, though: HTML 5 File API)

或者您可以使用新的文件访问API:http://hacks.mozilla.org/2009/12/w3c-fileapi-in-firefox-3-6/(它有很大的限制,但是:HTML 5 File API)

Javascript is a beautiful language! Please update this question with information on which route you choose.

Javascript是一门美妙的语言!请使用您选择的路线信息更新此问题。

#5


1  

If you're not a Microsoft basher and/or don't mind being bound to IE, a Hypertext Terminal Application (HTA) is another option. I once (long ago) create a complete and pretty large stand alone database-application using HTA.

如果您不是Microsoft的基础和/或不介意被绑定到IE,则超文本终端应用程序(HTA)是另一种选择。我曾经(很久以前)使用HTA创建一个完整且相当大的独立数据库应用程序。

#6


0  

Do you know PHP? I suggest you to install Wamp or phpTriad or something similar for Windows. That way you can reach to the local files. If it is Linux most of the *nix based operating systems have build in Apache and PHP..

你知道PHP吗?我建议你为Windows安装Wamp或phpTriad或类似的东西。这样您就可以访问本地文件。如果是Linux,大多数基于* nix的操作系统都是用Apache和PHP构建的。

#7


0  

Mozilla currently develops Chromeless, which seems to be able to do exactly what you want and has filesystem access

Mozilla目前正在开发Chromeless,它似乎能够完全满足您的需求并具有文件系统访问权限


推荐阅读
  • ShiftLeft:将静态防护与运行时防护结合的持续性安全防护解决方案
    ShiftLeft公司是一家致力于将应用的静态防护和运行时防护与应用开发自动化工作流相结合以提升软件开发生命周期中的安全性的公司。传统的安全防护方式存在误报率高、人工成本高、耗时长等问题,而ShiftLeft提供的持续性安全防护解决方案能够解决这些问题。通过将下一代静态代码分析与应用开发自动化工作流中涉及的安全工具相结合,ShiftLeft帮助企业实现DevSecOps的安全部分,提供高效、准确的安全能力。 ... [详细]
  • 本文介绍了在Android Studio中使用命令行build gradle的方法,并解决了一些常见问题,包括手动配置gradle环境变量和解决External Native Build Issues的方法。同时提供了相关参考文章链接。 ... [详细]
  • 本文整理了常用的CSS属性及用法,包括背景属性、边框属性、尺寸属性、可伸缩框属性、字体属性和文本属性等,方便开发者查阅和使用。 ... [详细]
  • java io换行符_Java IO:为什么从stdin读取时,换行符的数字表示出现在控制台上?...
    只是为了更好地理解我在讲座中听到的内容(关于Java输入和输出流),我自己做了这个小程序:publicstaticvoidmain(String[]args)thro ... [详细]
  • 向QTextEdit拖放文件的方法及实现步骤
    本文介绍了在使用QTextEdit时如何实现拖放文件的功能,包括相关的方法和实现步骤。通过重写dragEnterEvent和dropEvent函数,并结合QMimeData和QUrl等类,可以轻松实现向QTextEdit拖放文件的功能。详细的代码实现和说明可以参考本文提供的示例代码。 ... [详细]
  • baresip android编译、运行教程1语音通话
    本文介绍了如何在安卓平台上编译和运行baresip android,包括下载相关的sdk和ndk,修改ndk路径和输出目录,以及创建一个c++的安卓工程并将目录考到cpp下。详细步骤可参考给出的链接和文档。 ... [详细]
  • Android Studio Bumblebee | 2021.1.1(大黄蜂版本使用介绍)
    本文介绍了Android Studio Bumblebee | 2021.1.1(大黄蜂版本)的使用方法和相关知识,包括Gradle的介绍、设备管理器的配置、无线调试、新版本问题等内容。同时还提供了更新版本的下载地址和启动页面截图。 ... [详细]
  • 使用Ubuntu中的Python获取浏览器历史记录原文: ... [详细]
  • 本文介绍了Hyperledger Fabric外部链码构建与运行的相关知识,包括在Hyperledger Fabric 2.0版本之前链码构建和运行的困难性,外部构建模式的实现原理以及外部构建和运行API的使用方法。通过本文的介绍,读者可以了解到如何利用外部构建和运行的方式来实现链码的构建和运行,并且不再受限于特定的语言和部署环境。 ... [详细]
  • MyBatis错题分析解析及注意事项
    本文对MyBatis的错题进行了分析和解析,同时介绍了使用MyBatis时需要注意的一些事项,如resultMap的使用、SqlSession和SqlSessionFactory的获取方式、动态SQL中的else元素和when元素的使用、resource属性和url属性的配置方式、typeAliases的使用方法等。同时还指出了在属性名与查询字段名不一致时需要使用resultMap进行结果映射,而不能使用resultType。 ... [详细]
  • CF:3D City Model(小思维)问题解析和代码实现
    本文通过解析CF:3D City Model问题,介绍了问题的背景和要求,并给出了相应的代码实现。该问题涉及到在一个矩形的网格上建造城市的情景,每个网格单元可以作为建筑的基础,建筑由多个立方体叠加而成。文章详细讲解了问题的解决思路,并给出了相应的代码实现供读者参考。 ... [详细]
  • Ubuntu 9.04中安装谷歌Chromium浏览器及使用体验[图文]
    nsitionalENhttp:www.w3.orgTRxhtml1DTDxhtml1-transitional.dtd ... [详细]
  • 如何搭建Java开发环境并开发WinCE项目
    本文介绍了如何搭建Java开发环境并开发WinCE项目,包括搭建开发环境的步骤和获取SDK的几种方式。同时还解答了一些关于WinCE开发的常见问题。通过阅读本文,您将了解如何使用Java进行嵌入式开发,并能够顺利开发WinCE应用程序。 ... [详细]
  • Ihavethefollowingonhtml我在html上有以下内容<html><head><scriptsrc..3003_Tes ... [详细]
  • 项目需要实现弹幕,网上参考了各种方法,最后觉得transform+transition实现的效果在移动设备上性能最好,在iphone6和红米4上测试,看不到 ... [详细]
author-avatar
平凡黯淡_551
这个家伙很懒,什么也没留下!
PHP1.CN | 中国最专业的PHP中文社区 | DevBox开发工具箱 | json解析格式化 |PHP资讯 | PHP教程 | 数据库技术 | 服务器技术 | 前端开发技术 | PHP框架 | 开发工具 | 在线工具
Copyright © 1998 - 2020 PHP1.CN. All Rights Reserved | 京公网安备 11010802041100号 | 京ICP备19059560号-4 | PHP1.CN 第一PHP社区 版权所有