带有xulrunner的单文件应用-可能吗? [英] Single-file app with xulrunner - possible?
问题描述
我以前曾经尝试过xulrunner
,现在我再次尝试:)
I have tried to mess with xulrunner
before, and now I'm trying once again :)
真实"教程( XULRunner-MDN入门确实可以,实际上,表明应该具有application.ini
和其他文件(可能压缩为.xpi,然后需要--install-app ...
),然后调用应类似于:
The "real" tutorial (Getting started with XULRunner - MDN) does, in fact, show that one is supposed to have application.ini
and other files (possibly zipped as .xpi, which then requires --install-app ...
), and then the call should be like:
xulrunner `pwd`/application.ini
...但是,我想要一种更简单的启动方法-因此,我希望使用单文件XUL应用程序方法:)(这里的一个很好的说明是,也不能使用zipped. xpi作为xulrunner
的参数,请参见 XULRunner问题-DonationCoder. com )
... however, I'd like an easier way to start up - and hence, my hope for single-file XUL application approach :) (A good note here is that one also cannot use the zipped .xpi as an argument to xulrunner
, see XULRunner question - DonationCoder.com)
问题是,我几乎100%确信在过去的某个时候,我已经使用了一个简单的单文件XUL应用程序,如(伪代码):
The thing is, I am almost 100% certain that at some point in the past, I have used a simple single-file XUL application, as in (pseudocode):
xulrunner my-xul-app.extension
...但是我不记得它是怎么回事:)那么,使用xulrunner
还是仅使用firefox
是可能的吗?
... but I cannot remember how it went :) So, was that possible with xulrunner
, or only with firefox
?
据我所记得,我使用了类似"my-xul-app.xul"文件(作为单文件应用程序),该文件只能指定一个窗口只需一个按钮(由于缺少javascript 而无法执行任何操作)-我现在想重复一遍相同的内容以刷新我的记忆(除非我混淆了某些内容然后从后面:))
As far as I can remember, I used something like a 'my-xul-app.xul' file (as the single-file application), which would specify only, say, a window with a single button (that couldn't really do anything due to lack of javascript) - and I'd like to repeat the same thing now, to refresh my memory (unless I confused something from back then :))
首先,我发现 HOWTO:使用XUL的Linux独立应用程序入门-Ubuntu论坛(2007),我修改了example.xul
文件,该文件用作:
First of all, I found HOWTO: Getting Started with Linux Standalone Apps using XUL - Ubuntu Forums (2007), and I modified the example.xul
file used there as:
<?xml version="1.0"?>
<?xml-stylesheet href="chrome://global/skin/" type="text/css"?>
<window
id = "myapp"
title = "SQLite Example"
height = "420"
minHeight = "420"
width = "640"
minWidth = "640"
screenX = "10"
screenY = "10"
sizemode = "normal"
xmlns = "http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul" >
<spacer style = "height: 4px; cursor: default;" />
</window>
并且我正尝试按照链接中的建议运行"该命令,并使用
and I'm trying to "run" this as recommended in link, with:
firefox -no-remote -chrome file:$PWD/example.xul
...然后发生的情况是Firefox打开,窗口大小为1x1像素;如果可以找到手柄,则可以拉伸窗口,然后阅读:
... and what happens is that Firefox opens, with window size being like 1x1 pixels; if you can find the handle, you can stretch the window, and read:
远程XUL
该页面使用不受支持的技术,Firefox默认不再提供该技术.
Remote XUL
This page uses an unsupported technology that is no longer available by default in Firefox.
哦:(对此的答案(就像如何解决使用Firefox 4.x和Webmail高级界面时出现的Remote XUL错误? )似乎与实际远程 xul有关(并建议使用一个插件来处理该问题);但是我想要的只是在本地运行文件 ?!远程"部分从何而来?
Ouch :( Answers to this (like How do I fix the Remote XUL error I get when using Firefox 4.x and the Webmail Advanced Interface?) seem to be related to actual remote xul (and recommend a plugin to handle that); but what I want is simply to run a file locally?! Where did the "remote" part come from?
Also, seeing the firefox switch '-app
' (Using Firefox 3 as a XUL runtime environment); although it refers to an application.ini
, I tried this:
firefox -no-remote -app $PWD/example.xul
...,然后Firefox照常启动.
... and Firefox just started as usual.
顺便说一句,我在firefox --help
中都看不到-app
或-chrome
命令行选项;)
Btw, I cannot see neither -app
nor -chrome
command line options in firefox --help
;)
但是实际上,我并不是真的想将firefox
用作引擎-仅使用xulrunner
即可;我尝试了Firefox方法,因为我认为它与xulrunner
几乎没有什么相同;事实并非如此(即使您使用application.ini
:为什么'firefox -App application.ini"和"xulrunner application.ini"的行为不同吗?| Firefox支持论坛):
But actually, I do not really want to use firefox
as an engine - just the xulrunner
; and I tried the Firefox approach because I thought it is more-less the same as xulrunner
; turns out it isn't (even if you use application.ini
: Why does 'firefox -App application.ini' and 'xulrunner application.ini' behave differentely? | Firefox Support Forum):
无论如何,如果我只运行xulrunner
(如我所愿),我将得到:
In any case, if I run just xulrunner
(as I wanted to), I get:
$ xulrunner example.xul
Error: App:Name not specified in application.ini
因此,我可以看到所有内容均指向xulrunner
不可能指向单个源文件"应用程序-但我只是想确定一下(以防万一我错过了一些晦涩的教程:)).如果不是-有人记得在以前的某个时间是否有可能吗?
So, I can see everything points to "single source file" app not being possible with xulrunner
- but I just wanted to make sure (in case I missed some obscure tutorial :) ). And if it isn't - does anyone remember if it was possible at a previous point in time?
PS:
$ firefox --version
Mozilla Firefox 7.0.1
$ xulrunner --version
Mozilla XULRunner 2.0 - 20110402003021
$ uname -r
2.6.38-11-generic
$ cat /etc/issue
Ubuntu 11.04 \n \l
推荐答案
我不相信您可以创建单文件XULRunner应用程序. -chrome <...>
参数可能曾经起作用,我猜"Remote XUL"错误是由于URL为file://,而不是chrome://.
I don't believe you could ever create single-file XULRunner applications. The -chrome <...>
parameter probably used to work, I guess the "Remote XUL" error comes from the fact that the URL is file://, not chrome://.
您可以在开发者助手中使用类似 Live XUL编辑器的工具(以前是Extension Developer的扩展)来快速测试XUL.
You could use something like the Live XUL Editor in the Developer Assistant (formerly Extension Developer's extension) to test XUL quickly.
这些天,我听到的总体想法是,应该尽可能地编写HTML5,因为它是更加积极地开发的,更知名的技术,具有较少的不兼容更改和更好的工具...
The general idea I hear these days is that you should write HTML5 instead, whenever you can, since it is more actively developed, more well-known technology with less incompatible changes and better tooling...
这篇关于带有xulrunner的单文件应用-可能吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!