我开发了一个 Firefox 扩展,其中包含一个由此 XUL 脚本定义的小对话框:
<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet href="chrome://global/skin/" type="text/css"?>
<prefwindow id="firenowPreferences" xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul" title="Fire.Now" ondialogaccept='onSave();' onload="checkFields();">
<script type="application/x-javascript">function onSave(){ alert('blablabla');}</script>
<prefpane id="pane1">
<grid>
<rows>
<row align="center"><label control="username">Username</label><textbox id="username"/></row>
<row align="center"><label control="password">Password</label><textbox type="password" id="password"/></row>
</rows>
</grid>
</prefpane>
</prefwindow>
上面的代码可以尝试一下here
问题是在 Linux/Windows 平台上(在 Firefox 3.5/3.6 上)一切正常,我看到这样的东西:
http://img52.imageshack.us/img52/4210/shot1v.jpg
相反,在 Mac OS 上,我可以看到相同的内容,但没有按钮!
尝试 XUL 脚本 here ,如果您使用的是 Linux/Windows,结果与屏幕截图相同,但如果您使用的是 Mac,则有两个没有文本的小按钮(这很好,但在扩展中使用相同的 xul 代码,不会显示任何按钮)。
有什么建议吗?这是 Mac OS Firefox 的已知问题吗?
最佳答案
在 native Mac 应用程序中,首选项会立即生效,并且没有“确定”/“取消”按钮(例如,打开“系统首选项”)。 XUL <prefwindow>
模仿这种行为。
这种“即时应用”行为实际上是由首选项 browser.preferences.instantApply
控制的。 ,如果您在 Windows 计算机上进行设置,您将看到“确定/取消”按钮消失。
关于macos - 这是 Mac OS 上 Firefox 扩展的已知问题吗?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/2243377/