您必須將某些首選項設置爲xulrunner引擎。
首先,您必須訪問xulrunner的prefs.js文件。
Class<?> loadClass = Activator.getDefault().getClass()
.getClassLoader()
.loadClass("org.eclipse.swt.browser.MozillaDelegate");
Method declaredMethod = loadClass
.getDeclaredMethod("getProfilePath");
declaredMethod.setAccessible(true);
String profilePath = (String) declaredMethod.invoke(null);
File userPrefs = new File(profilePath + File.separator + "prefs.js"))
在這個文件中,你必須設置以下鍵值:這可以用下面的代碼片段來完成
capability.policy.policynames, allowclipboard
capability.policy.allowclipboard.Clipboard.cutcopy,allAccess
capability.policy.allowclipboard.Clipboard.paste,allAccess
capability.policy.allowclipboard.sites,file://
參見http://kb.mozillazine.org/Granting_JavaScript_access_to_the_clipboard
注:這只是工作,如果你的網站是本地的。否則,您必須將域添加到capability.policy.allowclipboard.sites
密鑰。