关于 javascript:在任务栏中打开一个没有图标的窗口

Opening a window without an icon in the taskbar

Firefox 中的"选项"打开:

  • 任务栏上没有图标
  • 正在阻止恢复到主窗口的能力。

如何扩展到其他窗口,输入:

1
chrome://browser/content/search/engineManager.xul

没有图标并且不在任务栏中?你的意思是一个对话窗口。

1
2
3
var ww = Components.classes["@mozilla.org/embedcomp/window-watcher;1"].getService(Components.interfaces.nsIWindowWatcher);

ww.openWindow(window,"chrome://browser/content/search/engineManager.xul","_blank","chrome,dialog,modal,centerscreen,resizable", null);

如果你想要在任务栏中没有图标并且没有任何显示,你必须传递第一个参数窗口,对话框将绑定到这个窗口,并且你必须将 dialogmodal 作为特性传递

https://developer.mozilla.org/en-US/docs/Mozilla/Tech/XPCOM/Reference/Interface/nsIWindowWatcher#openWindow()

也可以使用 Services.ww.openWindow 而不是 var ww = Components.classes["@mozilla.org/embedcomp/window-watcher;1"].getService(Components.interfaces.nsIWindowWatcher); 如果您导入了 Services.jsm.

@nmaier 那个家伙现在睡着了 :haha: 但是当你唤醒 nmaier man 时,是否有任何地方列出了我们可以在 features 参数中使用的所有选项?

编辑:更新:

它不工作的原因是因为在您的范围内 window 没有定义。因此,将窗口设置为最近的窗口,例如:Services.wm.getMostRecentWindow('navigator:browser')。或者您可以使用 null 代替 'navigator:browser'.

SDK 方式,因为这就是您在评论中所做的:

1
2
3
4
var {Cu} = require("chrome");
Cu.import('resource://gre/modules/Services.jsm');

Services.ww.openWindow(Services.wm.getMostRecentWindow('navigator:browser'),"chrome://browser/content/search/engineManager.xul","_blank","chrome,dialog,modal,centerscreen,resizable", null);