带有 xulrunner 的单文件应用程序 - 可能吗?

发布于 2024-12-11 12:03:54 字数 3584 浏览 0 评论 0原文

我之前曾尝试过搞乱xulrunner,现在我再次尝试:)

“真正的”教程(XULRunner 入门 - MDN)实际上表明应该拥有 application.ini 和其他文件(可能压缩为 .xpi,其中然后需要 --install-app ...),然后调用应该是这样的:

xulrunner `pwd`/application.ini

...但是,我想要一种更简单的启动方式 - 因此,我希望单文件 XUL 应用程序方法:) ( 这里需要注意的是,也不能使用压缩的 .xpi 作为 xulrunner 的参数,请参阅 XULRunner 问题 - DonationCoder.com )

 

问题是,我几乎 100% 确定在过去的某个时刻,我使用过一个简单的单文件 XUL 应用程序,如(伪代码):

xulrunner my-xul-app.extension

...但我不记得它是如何进行的:) 所以,是可以使用xulrunner,还是只能使用firefox

据我所知,我使用了类似“my-xul-app.xul”文件(作为单文件应用程序),它仅指定一个带有单个窗口的窗口按钮(由于缺少 javascript 而无法真正执行任何操作) - 我现在想重复同样的操作,以刷新我的记忆(除非我混淆了当时的某些内容:))

 

首先,我找到了 HOWTO:使用 XUL 开始使用 Linux 独立应用程序 - Ubuntu 论坛 (2007),我将其中使用的 example.xul 文件修改为:

<?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>

并且我尝试按照链接中的建议“运行”此文件:

firefox -no-remote -chrome file:$PWD/example.xul

... 发生的情况是Firefox 打开,窗口大小约为 1x1 像素;如果你能找到手柄,你可以拉伸窗口,并阅读:

远程 XUL
此页面使用了不受支持的技术,默认情况下,Firefox 中不再提供该技术。

哎哟 :( 对此的答案(如何修复使用 Firefox 4.x 和 Webmail 高级界面时出现的远程 XUL 错误? )似乎与实际远程 xul(并推荐一个插件来处理它);但我想要的只是本地运行文件?!“远程”部分来自哪里?

另外,

查看 Firefox 开关“-app”(使用 Firefox 3 作为XUL 运行时环境);虽然它引用了 application.ini,但我尝试了这个:

firefox -no-remote -app $PWD/example.xul

...并且 Firefox 刚刚像往常一样启动

,我什么都看不到 。 -appfirefox --help 中的 -chrome 命令行选项 ;)

 

但实际上,我并不是真的想使用 firefox 作为引擎 - 只是使用 xulrunner;我尝试了 Firefox 方法,因为我认为它与 xulrunner 或多或少相同;事实证明并非如此(即使您使用 application.ini为什么“firefox -App application.ini”和“xulrunner application.ini”的行为不同?| Firefox 支持论坛):

无论如何,如果我只运行xulrunner (如我所愿),我得到:

$ xulrunner example.xul 
Error: App:Name not specified in application.ini

 

因此,我可以看到所有内容都表明“单一源文件”应用程序无法使用 xulrunner 实现 - 但我只是想确定一下(以防我错过了一些晦涩的教程:))。如果不是——有人记得在之前的某个时间点这是否可能吗?

 

附:

$ 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

I have tried to mess with xulrunner before, and now I'm trying once again :)

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

... 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 )

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

... but I cannot remember how it went :) So, was that possible with xulrunner, or only with firefox?

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 :))

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

... 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:

Remote XUL
This page uses an unsupported technology that is no longer available by default in Firefox.

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

... and Firefox just started as usual.

Btw, I cannot see neither -app nor -chrome command line options in firefox --help ;)

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):

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

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

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

酒与心事 2024-12-18 12:03:54

我不相信您可以创建单文件 XULRunner 应用程序。 -chrome <...> 参数可能曾经起作用,我猜“Remote XUL”错误来自于 URL 是 file:// 而不是 chrome:// 的事实。

您可以使用开发者助手中的 Live XUL 编辑器 (以前的 Extension Developer 的扩展)快速测试 XUL。

我这些天听到的总体想法是,只要有可能,您就应该编写 HTML5,因为它是一种更积极开发、更知名的技术,具有更少的不兼容更改和更好的工具......

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://.

You could use something like the Live XUL Editor in the Developer Assistant (formerly Extension Developer's extension) to test XUL quickly.

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...

薄凉少年不暖心 2024-12-18 12:03:54

这是我为另一个相关问题编写的答案,在此转载是因为它可能会帮助那些想知道如何打包 XUL 应用程序的人。

遗憾的是,xulrunner 无法直接运行压缩的 .xpi 或 .xulapp,但可以将大部分 .js、.xul、.css 和 .png 文件打包到 jar 中,并用私有副本将所有内容包装起来xulrunner 的,无需运行 --install-app

这些是我打包 XUL 应用程序所经历的步骤。

第一步是将所有文件(application.inichrome.manifestprefs.js 除外)放入 .jar 文件中像这样(所有这些都是在Windows下进行的,对Linux和OSX进行适当的调整)

zip -r d:\download\space\akenispace.jar * -i *.js *.css *.png *.xul *.dtd 

然后在d:\download\space中,如下布局你的文件:

D:\download\space\akenispace.jar
D:\download\space\application.ini
D:\download\space\chrome.manifest
D:\download\space\defaults
D:\download\space\defaults\preferences
D:\download\space\defaults\preferences\prefs.js

文件内容如下

application .ini

[App]
Vendor=Akeni.Technologies
Name=Akeni.Space
Version=1.2.3
BuildID=20150125
Copyright=Copyright (c) 2015
[email protected]

[Gecko]
MinVersion=1.8
MaxVersion=35

chrome.manifest

content     akenispace             jar:akenispace.jar!/chrome/content/
skin        akenispace    default  jar:akenispace.jar!/chrome/skin/
locale      akenispace    en-US    jar:akenispace.jar!/chrome/locale/en-US/
resource    akenispace             jar:akenispace.jar!/chrome/resource/

prefs.js

pref("toolkit.defaultChromeURI", "chrome://akenispace/content/space.xul");

现在您可以将这些文件放入 WiX 的 .wxs 中并生成 MSI Windows 的文件。

当然,您还需要包含 XULRunner 的所有文件。

Here is the answer I wrote for another related question, reproduced here because it may help someone who want to know how to package their XUL application.

It is too bad that xulrunner can not run a zipped .xpi or .xulapp directly, but it is possible to package most of your .js, .xul, .css and .png files into a jar and wrap everything up with a private copy of xulrunner, without having to run --install-app

These are the steps I went through to package our XUL application.

The first step is to put all your files (except application.ini, chrome.manifest, and prefs.js) into a .jar file like this (all of this was carried out under Windows, make appropriate adjustments for Linux and OSX)

zip -r d:\download\space\akenispace.jar * -i *.js *.css *.png *.xul *.dtd 

Then in d:\download\space, layout your files as follows:

D:\download\space\akenispace.jar
D:\download\space\application.ini
D:\download\space\chrome.manifest
D:\download\space\defaults
D:\download\space\defaults\preferences
D:\download\space\defaults\preferences\prefs.js

The content of the files are as follows

application.ini

[App]
Vendor=Akeni.Technologies
Name=Akeni.Space
Version=1.2.3
BuildID=20150125
Copyright=Copyright (c) 2015
[email protected]

[Gecko]
MinVersion=1.8
MaxVersion=35

chrome.manifest

content     akenispace             jar:akenispace.jar!/chrome/content/
skin        akenispace    default  jar:akenispace.jar!/chrome/skin/
locale      akenispace    en-US    jar:akenispace.jar!/chrome/locale/en-US/
resource    akenispace             jar:akenispace.jar!/chrome/resource/

prefs.js

pref("toolkit.defaultChromeURI", "chrome://akenispace/content/space.xul");

Now you can put these files into your .wxs for WiX and produce an MSI file for Wndows.

Of course you need to include all the files for XULRunner as well.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文